JBoss Identity SVN: r912 - identity-federation/trunk/jboss-identity-bindings-jboss/src/main/java/org/jboss/identity/federation/bindings/jboss/subject.
by jboss-identity-commits@lists.jboss.org
Author: anil.saldhana(a)jboss.com
Date: 2009-11-06 12:42:49 -0500 (Fri, 06 Nov 2009)
New Revision: 912
Modified:
identity-federation/trunk/jboss-identity-bindings-jboss/src/main/java/org/jboss/identity/federation/bindings/jboss/subject/JBossIdentityPrincipal.java
Log:
hashcode equals
Modified: identity-federation/trunk/jboss-identity-bindings-jboss/src/main/java/org/jboss/identity/federation/bindings/jboss/subject/JBossIdentityPrincipal.java
===================================================================
--- identity-federation/trunk/jboss-identity-bindings-jboss/src/main/java/org/jboss/identity/federation/bindings/jboss/subject/JBossIdentityPrincipal.java 2009-11-06 17:40:13 UTC (rev 911)
+++ identity-federation/trunk/jboss-identity-bindings-jboss/src/main/java/org/jboss/identity/federation/bindings/jboss/subject/JBossIdentityPrincipal.java 2009-11-06 17:42:49 UTC (rev 912)
@@ -44,4 +44,33 @@
{
return name;
}
+
+ @Override
+ public int hashCode()
+ {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ JBossIdentityPrincipal other = (JBossIdentityPrincipal) obj;
+ if (name == null)
+ {
+ if (other.name != null)
+ return false;
+ }
+ else if (!name.equals(other.name))
+ return false;
+ return true;
+ }
}
\ No newline at end of file
16 years, 6 months
JBoss Identity SVN: r911 - in identity-federation/trunk: jboss-identity-bindings-jboss/src/main/java/org/jboss/identity/federation/bindings/jboss and 1 other directories.
by jboss-identity-commits@lists.jboss.org
Author: anil.saldhana(a)jboss.com
Date: 2009-11-06 12:40:13 -0500 (Fri, 06 Nov 2009)
New Revision: 911
Added:
identity-federation/trunk/jboss-identity-bindings-jboss/src/main/java/org/jboss/identity/federation/bindings/jboss/subject/
identity-federation/trunk/jboss-identity-bindings-jboss/src/main/java/org/jboss/identity/federation/bindings/jboss/subject/JBossIdentityGroup.java
identity-federation/trunk/jboss-identity-bindings-jboss/src/main/java/org/jboss/identity/federation/bindings/jboss/subject/JBossIdentityPrincipal.java
Removed:
identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/jboss/subject/JBossIdentityGroup.java
identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/jboss/subject/JBossIdentityPrincipal.java
Log:
refactor
Deleted: identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/jboss/subject/JBossIdentityGroup.java
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/jboss/subject/JBossIdentityGroup.java 2009-11-06 17:35:19 UTC (rev 910)
+++ identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/jboss/subject/JBossIdentityGroup.java 2009-11-06 17:40:13 UTC (rev 911)
@@ -1,67 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.identity.federation.bindings.jboss.subject;
-
-import java.security.Principal;
-import java.security.acl.Group;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * A Principal Group used to register roles in JBoss
- * @author Anil.Saldhana(a)redhat.com
- * @since Jan 16, 2009
- */
-public class JBossIdentityGroup extends JBossIdentityPrincipal implements Group
-{
- private static final long serialVersionUID = 1L;
-
- private Set<Principal> roles = new HashSet<Principal>();
-
- public JBossIdentityGroup(String name)
- {
- super(name);
- }
-
- public boolean addMember(Principal user)
- {
- return roles.add(user);
- }
-
- public boolean isMember(Principal member)
- {
- return roles.contains(member);
- }
-
- public Enumeration<? extends Principal> members()
- {
- Set<Principal> readOnly = Collections.unmodifiableSet(roles);
- return Collections.enumeration(readOnly);
- }
-
- public boolean removeMember(Principal user)
- {
- return roles.remove(user);
- }
-}
\ No newline at end of file
Deleted: identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/jboss/subject/JBossIdentityPrincipal.java
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/jboss/subject/JBossIdentityPrincipal.java 2009-11-06 17:35:19 UTC (rev 910)
+++ identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/jboss/subject/JBossIdentityPrincipal.java 2009-11-06 17:40:13 UTC (rev 911)
@@ -1,47 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.identity.federation.bindings.jboss.subject;
-
-import java.io.Serializable;
-import java.security.Principal;
-
-/**
- * Simple Principal
- * @author Anil.Saldhana(a)redhat.com
- * @since Jan 16, 2009
- */
-public class JBossIdentityPrincipal implements Principal,Serializable
-{
- private static final long serialVersionUID = 1L;
-
- protected String name;
-
- public JBossIdentityPrincipal(String name)
- {
- this.name = name;
- }
-
- public String getName()
- {
- return name;
- }
-}
\ No newline at end of file
Added: identity-federation/trunk/jboss-identity-bindings-jboss/src/main/java/org/jboss/identity/federation/bindings/jboss/subject/JBossIdentityGroup.java
===================================================================
--- identity-federation/trunk/jboss-identity-bindings-jboss/src/main/java/org/jboss/identity/federation/bindings/jboss/subject/JBossIdentityGroup.java (rev 0)
+++ identity-federation/trunk/jboss-identity-bindings-jboss/src/main/java/org/jboss/identity/federation/bindings/jboss/subject/JBossIdentityGroup.java 2009-11-06 17:40:13 UTC (rev 911)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.identity.federation.bindings.jboss.subject;
+
+import java.security.Principal;
+import java.security.acl.Group;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * A Principal Group used to register roles in JBoss
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Jan 16, 2009
+ */
+public class JBossIdentityGroup extends JBossIdentityPrincipal implements Group
+{
+ private static final long serialVersionUID = 1L;
+
+ private Set<Principal> roles = new HashSet<Principal>();
+
+ public JBossIdentityGroup(String name)
+ {
+ super(name);
+ }
+
+ public boolean addMember(Principal user)
+ {
+ return roles.add(user);
+ }
+
+ public boolean isMember(Principal member)
+ {
+ return roles.contains(member);
+ }
+
+ public Enumeration<? extends Principal> members()
+ {
+ Set<Principal> readOnly = Collections.unmodifiableSet(roles);
+ return Collections.enumeration(readOnly);
+ }
+
+ public boolean removeMember(Principal user)
+ {
+ return roles.remove(user);
+ }
+}
\ No newline at end of file
Added: identity-federation/trunk/jboss-identity-bindings-jboss/src/main/java/org/jboss/identity/federation/bindings/jboss/subject/JBossIdentityPrincipal.java
===================================================================
--- identity-federation/trunk/jboss-identity-bindings-jboss/src/main/java/org/jboss/identity/federation/bindings/jboss/subject/JBossIdentityPrincipal.java (rev 0)
+++ identity-federation/trunk/jboss-identity-bindings-jboss/src/main/java/org/jboss/identity/federation/bindings/jboss/subject/JBossIdentityPrincipal.java 2009-11-06 17:40:13 UTC (rev 911)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.identity.federation.bindings.jboss.subject;
+
+import java.io.Serializable;
+import java.security.Principal;
+
+/**
+ * Simple Principal
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Jan 16, 2009
+ */
+public class JBossIdentityPrincipal implements Principal,Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ protected String name;
+
+ public JBossIdentityPrincipal(String name)
+ {
+ this.name = name;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+}
\ No newline at end of file
16 years, 6 months
JBoss Identity SVN: r910 - in identity-federation/trunk: jboss-identity-web/src/main/java/org/jboss/identity/federation/web/servlets/saml and 1 other directories.
by jboss-identity-commits@lists.jboss.org
Author: anil.saldhana(a)jboss.com
Date: 2009-11-06 12:35:19 -0500 (Fri, 06 Nov 2009)
New Revision: 910
Added:
identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/servlets/saml/CircleOfTrustServlet.java
Removed:
identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/servlets/CircleOfTrustServlet.java
Modified:
identity-federation/trunk/jboss-identity-webapps/circleoftrust/resources/WEB-INF/web.xml
Log:
move servlet to web
Deleted: identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/servlets/CircleOfTrustServlet.java
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/servlets/CircleOfTrustServlet.java 2009-11-06 17:32:03 UTC (rev 909)
+++ identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/servlets/CircleOfTrustServlet.java 2009-11-06 17:35:19 UTC (rev 910)
@@ -1,259 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.identity.federation.bindings.servlets;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.HttpURLConnection;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-import javax.xml.bind.JAXBElement;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Unmarshaller;
-
-import org.jboss.identity.federation.api.saml.v2.metadata.MetaDataBuilder;
-import org.jboss.identity.federation.core.saml.v2.metadata.store.FileBasedMetadataConfigurationStore;
-import org.jboss.identity.federation.core.saml.v2.metadata.store.IMetadataConfigurationStore;
-import org.jboss.identity.federation.saml.v2.metadata.EntityDescriptorType;
-
-
-import static org.jboss.identity.federation.core.util.StringUtil.isNotNull;
-
-/**
- * Circle of trust establishing servlet that accesses
- * the metadata urls of the various sites and updates
- * the common store
- * @author Anil.Saldhana(a)redhat.com
- * @since Apr 23, 2009
- */
-public class CircleOfTrustServlet extends HttpServlet
-{
- private static final long serialVersionUID = 1L;
-
- private transient IMetadataConfigurationStore configProvider = new FileBasedMetadataConfigurationStore();
-
- @Override
- public void init(ServletConfig config) throws ServletException
- {
- super.init(config);
-
- String cstr = config.getInitParameter("configProvider");
- if(isNotNull(cstr))
- {
- ClassLoader tcl;
- try
- {
- tcl = SecurityActions.getContextClassLoader();
- configProvider = (IMetadataConfigurationStore) tcl.loadClass(cstr).newInstance();
- }
- catch (Exception e)
- {
- throw new ServletException(e);
- }
- }
- }
-
-
- @Override
- protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
- {
- //Handle listing of providers for either idp or sp
- //Handle adding an IDP
- //Handle adding a SP
- String action = req.getParameter("action");
- String type = req.getParameter("type");
- if(action == null)
- throw new ServletException("action is null");
- if(type == null)
- throw new ServletException("type is null");
-
- //SP
- if("sp".equalsIgnoreCase(type))
- {
- if("add".equalsIgnoreCase(action))
- {
- try
- {
- addIDP(req,resp);
- req.getRequestDispatcher("/addedIDP.jsp").forward(req, resp);
- }
- catch (Exception e)
- {
- throw new ServletException(e);
- }
- }
- if("display_trusted_providers".equalsIgnoreCase(action))
- {
- try
- {
- displayTrustedProvidersForSP(req,resp);
- req.getRequestDispatcher("/spTrustedProviders.jsp").forward(req, resp);
- }
- catch (Exception e)
- {
- throw new ServletException(e);
- }
- }
- }
- else
- //IDP
- if("idp".equalsIgnoreCase(type))
- {
- if("add".equalsIgnoreCase(action))
- {
- try
- {
- addSP(req,resp);
- req.getRequestDispatcher("/addedSP.jsp").forward(req, resp);
- }
- catch (Exception e)
- {
- throw new ServletException(e);
- }
- }
- if("display_trusted_providers".equalsIgnoreCase(action))
- {
- try
- {
- displayTrustedProvidersForIDP(req,resp);
- req.getRequestDispatcher("/idpTrustedProviders.jsp").forward(req, resp);
- }
- catch (Exception e)
- {
- throw new ServletException(e);
- }
- }
- }
- }
-
- private void addIDP(HttpServletRequest request, HttpServletResponse response)
- throws IOException, JAXBException
- {
- String spName = request.getParameter("spname");
- String idpName = request.getParameter("idpname");
- String metadataURL = request.getParameter("metadataURL");
-
- EntityDescriptorType edt = getMetaData(metadataURL);
-
- configProvider.persist(edt, idpName);
-
- HttpSession httpSession = request.getSession();
- httpSession.setAttribute("idp", edt);
-
- //Let us add the trusted providers
- Map<String,String> trustedProviders = new HashMap<String, String>();
- try
- {
- trustedProviders = configProvider.loadTrustedProviders(spName);
- }
- catch (ClassNotFoundException e)
- {
- log("Error obtaining the trusted providers for "+spName);
- throw new RuntimeException(e);
- }
- finally
- {
- trustedProviders.put(idpName, metadataURL);
- configProvider.persistTrustedProviders(spName, trustedProviders);
- }
- }
-
- private void addSP(HttpServletRequest request, HttpServletResponse response)
- throws JAXBException, IOException
- {
- String idpName = request.getParameter("idpname");
- String spName = request.getParameter("spname");
- String metadataURL = request.getParameter("metadataURL");
-
- EntityDescriptorType edt = getMetaData(metadataURL);
- configProvider.persist(edt, spName);
-
- HttpSession httpSession = request.getSession();
- httpSession.setAttribute("sp", edt);
-
- //Let us add the trusted providers
- Map<String,String> trustedProviders = new HashMap<String, String>();
- try
- {
- trustedProviders = configProvider.loadTrustedProviders(spName);
- }
- catch(Exception e)
- {
- log("Error obtaining the trusted providers for "+spName);
- }
- finally
- {
- trustedProviders.put(spName, metadataURL);
- configProvider.persistTrustedProviders(idpName, trustedProviders);
- }
- }
-
-
- private EntityDescriptorType getMetaData(String metadataURL) throws JAXBException, IOException
- {
- InputStream is;
- URL md = new URL(metadataURL);
- HttpURLConnection http = (HttpURLConnection) md.openConnection();
- http.setInstanceFollowRedirects(true);
- is = http.getInputStream();
-
- Unmarshaller un = MetaDataBuilder.getUnmarshaller();
- JAXBElement<?> j = (JAXBElement<?>) un.unmarshal(is);
- Object obj = j.getValue();
- if(obj instanceof EntityDescriptorType == false)
- throw new RuntimeException("Unsupported type:"+ obj.getClass());
- EntityDescriptorType edt = (EntityDescriptorType) obj;
- return edt;
- }
-
- private void displayTrustedProvidersForIDP(HttpServletRequest request, HttpServletResponse response)
- throws IOException, ClassNotFoundException
- {
- String idpName = request.getParameter("name");
-
- Map<String, String> trustedProviders = configProvider.loadTrustedProviders(idpName);
-
- HttpSession httpSession = request.getSession();
- httpSession.setAttribute("idpName", idpName);
- httpSession.setAttribute("providers", trustedProviders);
- }
-
- private void displayTrustedProvidersForSP(HttpServletRequest request, HttpServletResponse response)
- throws IOException, ClassNotFoundException
- {
- String spName = request.getParameter("name");
-
- Map<String, String> trustedProviders = configProvider.loadTrustedProviders(spName);
-
- HttpSession httpSession = request.getSession();
- httpSession.setAttribute("spName", spName);
- httpSession.setAttribute("providers", trustedProviders);
- }
-}
\ No newline at end of file
Added: identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/servlets/saml/CircleOfTrustServlet.java
===================================================================
--- identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/servlets/saml/CircleOfTrustServlet.java (rev 0)
+++ identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/servlets/saml/CircleOfTrustServlet.java 2009-11-06 17:35:19 UTC (rev 910)
@@ -0,0 +1,259 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.identity.federation.web.servlets.saml;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Unmarshaller;
+
+import org.jboss.identity.federation.api.saml.v2.metadata.MetaDataBuilder;
+import org.jboss.identity.federation.core.saml.v2.metadata.store.FileBasedMetadataConfigurationStore;
+import org.jboss.identity.federation.core.saml.v2.metadata.store.IMetadataConfigurationStore;
+import org.jboss.identity.federation.saml.v2.metadata.EntityDescriptorType;
+
+
+import static org.jboss.identity.federation.core.util.StringUtil.isNotNull;
+
+/**
+ * Circle of trust establishing servlet that accesses
+ * the metadata urls of the various sites and updates
+ * the common store
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Apr 23, 2009
+ */
+public class CircleOfTrustServlet extends HttpServlet
+{
+ private static final long serialVersionUID = 1L;
+
+ private transient IMetadataConfigurationStore configProvider = new FileBasedMetadataConfigurationStore();
+
+ @Override
+ public void init(ServletConfig config) throws ServletException
+ {
+ super.init(config);
+
+ String cstr = config.getInitParameter("configProvider");
+ if(isNotNull(cstr))
+ {
+ ClassLoader tcl;
+ try
+ {
+ tcl = SecurityActions.getContextClassLoader();
+ configProvider = (IMetadataConfigurationStore) tcl.loadClass(cstr).newInstance();
+ }
+ catch (Exception e)
+ {
+ throw new ServletException(e);
+ }
+ }
+ }
+
+
+ @Override
+ protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
+ {
+ //Handle listing of providers for either idp or sp
+ //Handle adding an IDP
+ //Handle adding a SP
+ String action = req.getParameter("action");
+ String type = req.getParameter("type");
+ if(action == null)
+ throw new ServletException("action is null");
+ if(type == null)
+ throw new ServletException("type is null");
+
+ //SP
+ if("sp".equalsIgnoreCase(type))
+ {
+ if("add".equalsIgnoreCase(action))
+ {
+ try
+ {
+ addIDP(req,resp);
+ req.getRequestDispatcher("/addedIDP.jsp").forward(req, resp);
+ }
+ catch (Exception e)
+ {
+ throw new ServletException(e);
+ }
+ }
+ if("display_trusted_providers".equalsIgnoreCase(action))
+ {
+ try
+ {
+ displayTrustedProvidersForSP(req,resp);
+ req.getRequestDispatcher("/spTrustedProviders.jsp").forward(req, resp);
+ }
+ catch (Exception e)
+ {
+ throw new ServletException(e);
+ }
+ }
+ }
+ else
+ //IDP
+ if("idp".equalsIgnoreCase(type))
+ {
+ if("add".equalsIgnoreCase(action))
+ {
+ try
+ {
+ addSP(req,resp);
+ req.getRequestDispatcher("/addedSP.jsp").forward(req, resp);
+ }
+ catch (Exception e)
+ {
+ throw new ServletException(e);
+ }
+ }
+ if("display_trusted_providers".equalsIgnoreCase(action))
+ {
+ try
+ {
+ displayTrustedProvidersForIDP(req,resp);
+ req.getRequestDispatcher("/idpTrustedProviders.jsp").forward(req, resp);
+ }
+ catch (Exception e)
+ {
+ throw new ServletException(e);
+ }
+ }
+ }
+ }
+
+ private void addIDP(HttpServletRequest request, HttpServletResponse response)
+ throws IOException, JAXBException
+ {
+ String spName = request.getParameter("spname");
+ String idpName = request.getParameter("idpname");
+ String metadataURL = request.getParameter("metadataURL");
+
+ EntityDescriptorType edt = getMetaData(metadataURL);
+
+ configProvider.persist(edt, idpName);
+
+ HttpSession httpSession = request.getSession();
+ httpSession.setAttribute("idp", edt);
+
+ //Let us add the trusted providers
+ Map<String,String> trustedProviders = new HashMap<String, String>();
+ try
+ {
+ trustedProviders = configProvider.loadTrustedProviders(spName);
+ }
+ catch (ClassNotFoundException e)
+ {
+ log("Error obtaining the trusted providers for "+spName);
+ throw new RuntimeException(e);
+ }
+ finally
+ {
+ trustedProviders.put(idpName, metadataURL);
+ configProvider.persistTrustedProviders(spName, trustedProviders);
+ }
+ }
+
+ private void addSP(HttpServletRequest request, HttpServletResponse response)
+ throws JAXBException, IOException
+ {
+ String idpName = request.getParameter("idpname");
+ String spName = request.getParameter("spname");
+ String metadataURL = request.getParameter("metadataURL");
+
+ EntityDescriptorType edt = getMetaData(metadataURL);
+ configProvider.persist(edt, spName);
+
+ HttpSession httpSession = request.getSession();
+ httpSession.setAttribute("sp", edt);
+
+ //Let us add the trusted providers
+ Map<String,String> trustedProviders = new HashMap<String, String>();
+ try
+ {
+ trustedProviders = configProvider.loadTrustedProviders(spName);
+ }
+ catch(Exception e)
+ {
+ log("Error obtaining the trusted providers for "+spName);
+ }
+ finally
+ {
+ trustedProviders.put(spName, metadataURL);
+ configProvider.persistTrustedProviders(idpName, trustedProviders);
+ }
+ }
+
+
+ private EntityDescriptorType getMetaData(String metadataURL) throws JAXBException, IOException
+ {
+ InputStream is;
+ URL md = new URL(metadataURL);
+ HttpURLConnection http = (HttpURLConnection) md.openConnection();
+ http.setInstanceFollowRedirects(true);
+ is = http.getInputStream();
+
+ Unmarshaller un = MetaDataBuilder.getUnmarshaller();
+ JAXBElement<?> j = (JAXBElement<?>) un.unmarshal(is);
+ Object obj = j.getValue();
+ if(obj instanceof EntityDescriptorType == false)
+ throw new RuntimeException("Unsupported type:"+ obj.getClass());
+ EntityDescriptorType edt = (EntityDescriptorType) obj;
+ return edt;
+ }
+
+ private void displayTrustedProvidersForIDP(HttpServletRequest request, HttpServletResponse response)
+ throws IOException, ClassNotFoundException
+ {
+ String idpName = request.getParameter("name");
+
+ Map<String, String> trustedProviders = configProvider.loadTrustedProviders(idpName);
+
+ HttpSession httpSession = request.getSession();
+ httpSession.setAttribute("idpName", idpName);
+ httpSession.setAttribute("providers", trustedProviders);
+ }
+
+ private void displayTrustedProvidersForSP(HttpServletRequest request, HttpServletResponse response)
+ throws IOException, ClassNotFoundException
+ {
+ String spName = request.getParameter("name");
+
+ Map<String, String> trustedProviders = configProvider.loadTrustedProviders(spName);
+
+ HttpSession httpSession = request.getSession();
+ httpSession.setAttribute("spName", spName);
+ httpSession.setAttribute("providers", trustedProviders);
+ }
+}
\ No newline at end of file
Modified: identity-federation/trunk/jboss-identity-webapps/circleoftrust/resources/WEB-INF/web.xml
===================================================================
--- identity-federation/trunk/jboss-identity-webapps/circleoftrust/resources/WEB-INF/web.xml 2009-11-06 17:32:03 UTC (rev 909)
+++ identity-federation/trunk/jboss-identity-webapps/circleoftrust/resources/WEB-INF/web.xml 2009-11-06 17:35:19 UTC (rev 910)
@@ -9,7 +9,7 @@
<servlet>
<servlet-name>COTServlet</servlet-name>
- <servlet-class>org.jboss.identity.federation.bindings.servlets.CircleOfTrustServlet</servlet-class>
+ <servlet-class>org.jboss.identity.federation.web.servlets.saml.CircleOfTrustServlet</servlet-class>
<init-param>
<param-name>issuer</param-name>
<param-value>redhatPdpEntity</param-value>
16 years, 6 months
JBoss Identity SVN: r909 - in identity-federation/trunk/jboss-identity-webapps: circleoftrust and 132 other directories.
by jboss-identity-commits@lists.jboss.org
Author: anil.saldhana(a)jboss.com
Date: 2009-11-06 12:32:03 -0500 (Fri, 06 Nov 2009)
New Revision: 909
Modified:
identity-federation/trunk/jboss-identity-webapps/
identity-federation/trunk/jboss-identity-webapps/circleoftrust/
identity-federation/trunk/jboss-identity-webapps/circleoftrust/resources/
identity-federation/trunk/jboss-identity-webapps/circleoftrust/resources/META-INF/
identity-federation/trunk/jboss-identity-webapps/circleoftrust/resources/WEB-INF/
identity-federation/trunk/jboss-identity-webapps/employee-post-sig/
identity-federation/trunk/jboss-identity-webapps/employee-post-sig/.settings/
identity-federation/trunk/jboss-identity-webapps/employee-post-sig/src/
identity-federation/trunk/jboss-identity-webapps/employee-post-sig/src/main/
identity-federation/trunk/jboss-identity-webapps/employee-post-sig/src/main/resources/
identity-federation/trunk/jboss-identity-webapps/employee-post-sig/src/main/webapp/
identity-federation/trunk/jboss-identity-webapps/employee-post-sig/src/main/webapp/META-INF/
identity-federation/trunk/jboss-identity-webapps/employee-post-sig/src/main/webapp/WEB-INF/
identity-federation/trunk/jboss-identity-webapps/employee-post-sig/src/main/webapp/WEB-INF/lib/
identity-federation/trunk/jboss-identity-webapps/employee/
identity-federation/trunk/jboss-identity-webapps/employee/src/
identity-federation/trunk/jboss-identity-webapps/employee/src/main/
identity-federation/trunk/jboss-identity-webapps/employee/src/main/resources/
identity-federation/trunk/jboss-identity-webapps/employee/src/main/webapp/
identity-federation/trunk/jboss-identity-webapps/employee/src/main/webapp/META-INF/
identity-federation/trunk/jboss-identity-webapps/employee/src/main/webapp/WEB-INF/
identity-federation/trunk/jboss-identity-webapps/fed-example/
identity-federation/trunk/jboss-identity-webapps/fed-example/src/
identity-federation/trunk/jboss-identity-webapps/fed-example/src/main/
identity-federation/trunk/jboss-identity-webapps/fed-example/src/main/application/
identity-federation/trunk/jboss-identity-webapps/fed-example/src/main/application/META-INF/
identity-federation/trunk/jboss-identity-webapps/idp-sig-no-val/
identity-federation/trunk/jboss-identity-webapps/idp-sig-no-val/src/
identity-federation/trunk/jboss-identity-webapps/idp-sig-no-val/src/main/
identity-federation/trunk/jboss-identity-webapps/idp-sig-no-val/src/main/resources/
identity-federation/trunk/jboss-identity-webapps/idp-sig-no-val/src/main/webapp/
identity-federation/trunk/jboss-identity-webapps/idp-sig-no-val/src/main/webapp/META-INF/
identity-federation/trunk/jboss-identity-webapps/idp-sig-no-val/src/main/webapp/WEB-INF/
identity-federation/trunk/jboss-identity-webapps/idp-sig-no-val/src/main/webapp/WEB-INF/classes/
identity-federation/trunk/jboss-identity-webapps/idp-sig-no-val/src/main/webapp/WEB-INF/lib/
identity-federation/trunk/jboss-identity-webapps/idp-sig-no-val/src/main/webapp/jsp/
identity-federation/trunk/jboss-identity-webapps/idp-sig/
identity-federation/trunk/jboss-identity-webapps/idp-sig/src/
identity-federation/trunk/jboss-identity-webapps/idp-sig/src/main/
identity-federation/trunk/jboss-identity-webapps/idp-sig/src/main/resources/
identity-federation/trunk/jboss-identity-webapps/idp-sig/src/main/webapp/
identity-federation/trunk/jboss-identity-webapps/idp-sig/src/main/webapp/META-INF/
identity-federation/trunk/jboss-identity-webapps/idp-sig/src/main/webapp/WEB-INF/
identity-federation/trunk/jboss-identity-webapps/idp-sig/src/main/webapp/WEB-INF/classes/
identity-federation/trunk/jboss-identity-webapps/idp-sig/src/main/webapp/WEB-INF/lib/
identity-federation/trunk/jboss-identity-webapps/idp-sig/src/main/webapp/jsp/
identity-federation/trunk/jboss-identity-webapps/idp-standalone/
identity-federation/trunk/jboss-identity-webapps/idp-standalone/src/
identity-federation/trunk/jboss-identity-webapps/idp-standalone/src/main/
identity-federation/trunk/jboss-identity-webapps/idp-standalone/src/main/resources/
identity-federation/trunk/jboss-identity-webapps/idp-standalone/src/main/webapp/
identity-federation/trunk/jboss-identity-webapps/idp-standalone/src/main/webapp/META-INF/
identity-federation/trunk/jboss-identity-webapps/idp-standalone/src/main/webapp/WEB-INF/
identity-federation/trunk/jboss-identity-webapps/idp-standalone/src/main/webapp/WEB-INF/classes/
identity-federation/trunk/jboss-identity-webapps/idp-standalone/src/main/webapp/jsp/
identity-federation/trunk/jboss-identity-webapps/idp/
identity-federation/trunk/jboss-identity-webapps/idp/src/
identity-federation/trunk/jboss-identity-webapps/idp/src/main/
identity-federation/trunk/jboss-identity-webapps/idp/src/main/resources/
identity-federation/trunk/jboss-identity-webapps/idp/src/main/webapp/
identity-federation/trunk/jboss-identity-webapps/idp/src/main/webapp/META-INF/
identity-federation/trunk/jboss-identity-webapps/idp/src/main/webapp/WEB-INF/
identity-federation/trunk/jboss-identity-webapps/idp/src/main/webapp/jsp/
identity-federation/trunk/jboss-identity-webapps/jboss-sts/
identity-federation/trunk/jboss-identity-webapps/jboss-sts/src/
identity-federation/trunk/jboss-identity-webapps/jboss-sts/src/main/
identity-federation/trunk/jboss-identity-webapps/jboss-sts/src/main/resources/
identity-federation/trunk/jboss-identity-webapps/jboss-sts/src/main/webapp/
identity-federation/trunk/jboss-identity-webapps/jboss-sts/src/main/webapp/WEB-INF/
identity-federation/trunk/jboss-identity-webapps/jboss-sts/src/main/webapp/WEB-INF/lib/
identity-federation/trunk/jboss-identity-webapps/jboss-sts/src/main/webapp/WEB-INF/wsdl/
identity-federation/trunk/jboss-identity-webapps/metadata/
identity-federation/trunk/jboss-identity-webapps/metadata/resources/
identity-federation/trunk/jboss-identity-webapps/metadata/resources/META-INF/
identity-federation/trunk/jboss-identity-webapps/metadata/resources/WEB-INF/
identity-federation/trunk/jboss-identity-webapps/openid-consumer/
identity-federation/trunk/jboss-identity-webapps/openid-consumer/resources/
identity-federation/trunk/jboss-identity-webapps/openid-consumer/resources/META-INF/
identity-federation/trunk/jboss-identity-webapps/openid-consumer/resources/WEB-INF/
identity-federation/trunk/jboss-identity-webapps/openid-provider/
identity-federation/trunk/jboss-identity-webapps/openid-provider/resources/
identity-federation/trunk/jboss-identity-webapps/openid-provider/resources/META-INF/
identity-federation/trunk/jboss-identity-webapps/openid-provider/resources/WEB-INF/
identity-federation/trunk/jboss-identity-webapps/pdp/
identity-federation/trunk/jboss-identity-webapps/pdp/src/
identity-federation/trunk/jboss-identity-webapps/pdp/src/main/
identity-federation/trunk/jboss-identity-webapps/pdp/src/main/webapp/
identity-federation/trunk/jboss-identity-webapps/pdp/src/main/webapp/META-INF/
identity-federation/trunk/jboss-identity-webapps/pdp/src/main/webapp/WEB-INF/
identity-federation/trunk/jboss-identity-webapps/pdp/src/main/webapp/WEB-INF/classes/
identity-federation/trunk/jboss-identity-webapps/pdp/src/main/webapp/WEB-INF/classes/policies/
identity-federation/trunk/jboss-identity-webapps/sales-post-sig/
identity-federation/trunk/jboss-identity-webapps/sales-post-sig/src/
identity-federation/trunk/jboss-identity-webapps/sales-post-sig/src/main/
identity-federation/trunk/jboss-identity-webapps/sales-post-sig/src/main/resources/
identity-federation/trunk/jboss-identity-webapps/sales-post-sig/src/main/webapp/
identity-federation/trunk/jboss-identity-webapps/sales-post-sig/src/main/webapp/META-INF/
identity-federation/trunk/jboss-identity-webapps/sales-post-sig/src/main/webapp/WEB-INF/
identity-federation/trunk/jboss-identity-webapps/sales-post-sig/src/main/webapp/WEB-INF/lib/
identity-federation/trunk/jboss-identity-webapps/sales-sig/
identity-federation/trunk/jboss-identity-webapps/sales-sig/src/
identity-federation/trunk/jboss-identity-webapps/sales-sig/src/main/
identity-federation/trunk/jboss-identity-webapps/sales-sig/src/main/webapp/
identity-federation/trunk/jboss-identity-webapps/sales-sig/src/main/webapp/META-INF/
identity-federation/trunk/jboss-identity-webapps/sales-sig/src/main/webapp/WEB-INF/
identity-federation/trunk/jboss-identity-webapps/sales-standalone/
identity-federation/trunk/jboss-identity-webapps/sales-standalone/src/
identity-federation/trunk/jboss-identity-webapps/sales-standalone/src/main/
identity-federation/trunk/jboss-identity-webapps/sales-standalone/src/main/resources/
identity-federation/trunk/jboss-identity-webapps/sales-standalone/src/main/webapp/
identity-federation/trunk/jboss-identity-webapps/sales-standalone/src/main/webapp/META-INF/
identity-federation/trunk/jboss-identity-webapps/sales-standalone/src/main/webapp/WEB-INF/
identity-federation/trunk/jboss-identity-webapps/sales-standalone/src/main/webapp/WEB-INF/classes/
identity-federation/trunk/jboss-identity-webapps/sales/
identity-federation/trunk/jboss-identity-webapps/sales/src/
identity-federation/trunk/jboss-identity-webapps/sales/src/main/
identity-federation/trunk/jboss-identity-webapps/sales/src/main/resources/
identity-federation/trunk/jboss-identity-webapps/sales/src/main/webapp/
identity-federation/trunk/jboss-identity-webapps/sales/src/main/webapp/META-INF/
identity-federation/trunk/jboss-identity-webapps/sales/src/main/webapp/WEB-INF/
identity-federation/trunk/jboss-identity-webapps/sales/src/main/webapp/WEB-INF/lib/
identity-federation/trunk/jboss-identity-webapps/seam-sp/
identity-federation/trunk/jboss-identity-webapps/seam-sp/src/
identity-federation/trunk/jboss-identity-webapps/seam-sp/src/main/
identity-federation/trunk/jboss-identity-webapps/seam-sp/src/main/java/
identity-federation/trunk/jboss-identity-webapps/seam-sp/src/main/java/org/
identity-federation/trunk/jboss-identity-webapps/seam-sp/src/main/java/org/jboss/
identity-federation/trunk/jboss-identity-webapps/seam-sp/src/main/java/org/jboss/identity/
identity-federation/trunk/jboss-identity-webapps/seam-sp/src/main/java/org/jboss/identity/seam/
identity-federation/trunk/jboss-identity-webapps/seam-sp/src/main/java/org/jboss/identity/seam/federation/
identity-federation/trunk/jboss-identity-webapps/seam-sp/src/main/resources/
identity-federation/trunk/jboss-identity-webapps/seam-sp/src/main/webapp/
identity-federation/trunk/jboss-identity-webapps/seam-sp/src/main/webapp/META-INF/
identity-federation/trunk/jboss-identity-webapps/seam-sp/src/main/webapp/WEB-INF/
Log:
svn ig
Property changes on: identity-federation/trunk/jboss-identity-webapps
___________________________________________________________________
Name: svn:ignore
- .metadata
.classpath
.settings
.project
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/circleoftrust
___________________________________________________________________
Name: svn:ignore
- .metadata
.classpath
.settings
.project
target
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/circleoftrust/resources
___________________________________________________________________
Name: svn:ignore
- .metadata
.classpath
.settings
.project
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/circleoftrust/resources/META-INF
___________________________________________________________________
Name: svn:ignore
- .metadata
.classpath
.settings
.project
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/circleoftrust/resources/WEB-INF
___________________________________________________________________
Name: svn:ignore
- .metadata
.classpath
.settings
.project
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/employee
___________________________________________________________________
Name: svn:ignore
- .metadata
.classpath
.settings
.project
target
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/employee/src
___________________________________________________________________
Name: svn:ignore
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/employee/src/main
___________________________________________________________________
Name: svn:ignore
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/employee/src/main/resources
___________________________________________________________________
Name: svn:ignore
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/employee/src/main/webapp
___________________________________________________________________
Name: svn:ignore
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/employee/src/main/webapp/META-INF
___________________________________________________________________
Name: svn:ignore
- .metadata
target
.settings
target-eclipse
eclipse-target
.classpath
.project
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/employee/src/main/webapp/WEB-INF
___________________________________________________________________
Name: svn:ignore
- .metadata
target
.settings
target-eclipse
eclipse-target
.classpath
.project
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/employee-post-sig
___________________________________________________________________
Name: svn:ignore
- target
.settings
.project
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/employee-post-sig/.settings
___________________________________________________________________
Name: svn:ignore
- target
.settings
.project
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/employee-post-sig/src
___________________________________________________________________
Name: svn:ignore
- target
.settings
.project
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/employee-post-sig/src/main
___________________________________________________________________
Name: svn:ignore
- target
.settings
.project
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/employee-post-sig/src/main/resources
___________________________________________________________________
Name: svn:ignore
- target
.settings
.project
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/employee-post-sig/src/main/webapp
___________________________________________________________________
Name: svn:ignore
- target
.settings
.project
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/employee-post-sig/src/main/webapp/META-INF
___________________________________________________________________
Name: svn:ignore
- target
.settings
.project
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/employee-post-sig/src/main/webapp/WEB-INF
___________________________________________________________________
Name: svn:ignore
- target
.settings
.project
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/employee-post-sig/src/main/webapp/WEB-INF/lib
___________________________________________________________________
Name: svn:ignore
- target
.settings
.project
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/fed-example
___________________________________________________________________
Name: svn:ignore
- target
.classpath
.project
.settings
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/fed-example/src
___________________________________________________________________
Name: svn:ignore
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/fed-example/src/main
___________________________________________________________________
Name: svn:ignore
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/fed-example/src/main/application
___________________________________________________________________
Name: svn:ignore
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/fed-example/src/main/application/META-INF
___________________________________________________________________
Name: svn:ignore
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/idp
___________________________________________________________________
Name: svn:ignore
- .metadata
.classpath
.settings
.project
target
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/idp/src
___________________________________________________________________
Name: svn:ignore
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/idp/src/main
___________________________________________________________________
Name: svn:ignore
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/idp/src/main/resources
___________________________________________________________________
Name: svn:ignore
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/idp/src/main/webapp
___________________________________________________________________
Name: svn:ignore
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/idp/src/main/webapp/META-INF
___________________________________________________________________
Name: svn:ignore
- .metadata
target
.settings
target-eclipse
eclipse-target
.classpath
.project
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/idp/src/main/webapp/WEB-INF
___________________________________________________________________
Name: svn:ignore
- .metadata
target
.settings
target-eclipse
eclipse-target
.classpath
.project
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/idp/src/main/webapp/jsp
___________________________________________________________________
Name: svn:ignore
- .metadata
target
.settings
target-eclipse
eclipse-target
.classpath
.project
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/idp-sig
___________________________________________________________________
Name: svn:ignore
- .metadata
.classpath
.settings
.project
target
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/idp-sig/src
___________________________________________________________________
Name: svn:ignore
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/idp-sig/src/main
___________________________________________________________________
Name: svn:ignore
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/idp-sig/src/main/resources
___________________________________________________________________
Name: svn:ignore
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/idp-sig/src/main/webapp
___________________________________________________________________
Name: svn:ignore
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/idp-sig/src/main/webapp/META-INF
___________________________________________________________________
Name: svn:ignore
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/idp-sig/src/main/webapp/WEB-INF
___________________________________________________________________
Name: svn:ignore
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/idp-sig/src/main/webapp/WEB-INF/classes
___________________________________________________________________
Name: svn:ignore
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/idp-sig/src/main/webapp/WEB-INF/lib
___________________________________________________________________
Name: svn:ignore
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/idp-sig/src/main/webapp/jsp
___________________________________________________________________
Name: svn:ignore
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/idp-sig-no-val
___________________________________________________________________
Name: svn:ignore
- target
.settings
.classpath
.project
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/idp-sig-no-val/src
___________________________________________________________________
Name: svn:ignore
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/idp-sig-no-val/src/main
___________________________________________________________________
Name: svn:ignore
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/idp-sig-no-val/src/main/resources
___________________________________________________________________
Name: svn:ignore
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/idp-sig-no-val/src/main/webapp
___________________________________________________________________
Name: svn:ignore
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/idp-sig-no-val/src/main/webapp/META-INF
___________________________________________________________________
Name: svn:ignore
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/idp-sig-no-val/src/main/webapp/WEB-INF
___________________________________________________________________
Name: svn:ignore
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/idp-sig-no-val/src/main/webapp/WEB-INF/classes
___________________________________________________________________
Name: svn:ignore
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/idp-sig-no-val/src/main/webapp/WEB-INF/lib
___________________________________________________________________
Name: svn:ignore
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/idp-sig-no-val/src/main/webapp/jsp
___________________________________________________________________
Name: svn:ignore
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/idp-standalone
___________________________________________________________________
Name: svn:ignore
- target
target-eclipse
eclipse-target
.settings
.project
.metadata
.classpath
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/idp-standalone/src
___________________________________________________________________
Name: svn:ignore
- target
target-eclipse
eclipse-target
.settings
.project
.metadata
.classpath
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/idp-standalone/src/main
___________________________________________________________________
Name: svn:ignore
- target
target-eclipse
eclipse-target
.settings
.project
.metadata
.classpath
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/idp-standalone/src/main/resources
___________________________________________________________________
Name: svn:ignore
- target
target-eclipse
eclipse-target
.settings
.project
.metadata
.classpath
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/idp-standalone/src/main/webapp
___________________________________________________________________
Name: svn:ignore
- target
target-eclipse
eclipse-target
.settings
.project
.metadata
.classpath
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/idp-standalone/src/main/webapp/META-INF
___________________________________________________________________
Name: svn:ignore
- target
target-eclipse
eclipse-target
.settings
.project
.metadata
.classpath
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/idp-standalone/src/main/webapp/WEB-INF
___________________________________________________________________
Name: svn:ignore
- target
target-eclipse
eclipse-target
.settings
.project
.metadata
.classpath
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/idp-standalone/src/main/webapp/WEB-INF/classes
___________________________________________________________________
Name: svn:ignore
- target
target-eclipse
eclipse-target
.settings
.project
.metadata
.classpath
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/idp-standalone/src/main/webapp/jsp
___________________________________________________________________
Name: svn:ignore
- target
target-eclipse
eclipse-target
.settings
.project
.metadata
.classpath
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/jboss-sts
___________________________________________________________________
Name: svn:ignore
- .metadata
.classpath
.settings
.project
target
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/jboss-sts/src
___________________________________________________________________
Name: svn:ignore
- .metadata
.classpath
.settings
.project
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/jboss-sts/src/main
___________________________________________________________________
Name: svn:ignore
- .metadata
.classpath
.settings
.project
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/jboss-sts/src/main/resources
___________________________________________________________________
Name: svn:ignore
- .metadata
.classpath
.settings
.project
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/jboss-sts/src/main/webapp
___________________________________________________________________
Name: svn:ignore
- .metadata
.classpath
.settings
.project
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/jboss-sts/src/main/webapp/WEB-INF
___________________________________________________________________
Name: svn:ignore
- .metadata
.classpath
.settings
.project
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/jboss-sts/src/main/webapp/WEB-INF/lib
___________________________________________________________________
Name: svn:ignore
- .metadata
.classpath
.settings
.project
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/jboss-sts/src/main/webapp/WEB-INF/wsdl
___________________________________________________________________
Name: svn:ignore
- .metadata
.classpath
.settings
.project
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/metadata
___________________________________________________________________
Name: svn:ignore
- .metadata
.classpath
.settings
.project
target
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/metadata/resources
___________________________________________________________________
Name: svn:ignore
- .metadata
.classpath
.settings
.project
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/metadata/resources/META-INF
___________________________________________________________________
Name: svn:ignore
- .metadata
.classpath
.settings
.project
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/metadata/resources/WEB-INF
___________________________________________________________________
Name: svn:ignore
- .metadata
.classpath
.settings
.project
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/openid-consumer
___________________________________________________________________
Name: svn:ignore
- .metadata
.classpath
.settings
.project
target
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/openid-consumer/resources
___________________________________________________________________
Name: svn:ignore
- .metadata
.classpath
.settings
.project
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/openid-consumer/resources/META-INF
___________________________________________________________________
Name: svn:ignore
- .metadata
.classpath
.settings
.project
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/openid-consumer/resources/WEB-INF
___________________________________________________________________
Name: svn:ignore
- .metadata
.classpath
.settings
.project
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/openid-provider
___________________________________________________________________
Name: svn:ignore
- .metadata
.classpath
.settings
.project
target
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/openid-provider/resources
___________________________________________________________________
Name: svn:ignore
- .metadata
.classpath
.settings
.project
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/openid-provider/resources/META-INF
___________________________________________________________________
Name: svn:ignore
- .metadata
.classpath
.settings
.project
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/openid-provider/resources/WEB-INF
___________________________________________________________________
Name: svn:ignore
- .metadata
.classpath
.settings
.project
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/pdp
___________________________________________________________________
Name: svn:ignore
- target
target-eclipse
eclipse-target
.settings
.project
.metadata
.classpath
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/pdp/src
___________________________________________________________________
Name: svn:ignore
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/pdp/src/main
___________________________________________________________________
Name: svn:ignore
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/pdp/src/main/webapp
___________________________________________________________________
Name: svn:ignore
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/pdp/src/main/webapp/META-INF
___________________________________________________________________
Name: svn:ignore
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/pdp/src/main/webapp/WEB-INF
___________________________________________________________________
Name: svn:ignore
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/pdp/src/main/webapp/WEB-INF/classes
___________________________________________________________________
Name: svn:ignore
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/pdp/src/main/webapp/WEB-INF/classes/policies
___________________________________________________________________
Name: svn:ignore
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/sales
___________________________________________________________________
Name: svn:ignore
- .metadata
.classpath
.settings
.project
target
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/sales/src
___________________________________________________________________
Name: svn:ignore
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/sales/src/main
___________________________________________________________________
Name: svn:ignore
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/sales/src/main/resources
___________________________________________________________________
Name: svn:ignore
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/sales/src/main/webapp
___________________________________________________________________
Name: svn:ignore
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/sales/src/main/webapp/META-INF
___________________________________________________________________
Name: svn:ignore
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/sales/src/main/webapp/WEB-INF
___________________________________________________________________
Name: svn:ignore
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/sales/src/main/webapp/WEB-INF/lib
___________________________________________________________________
Name: svn:ignore
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/sales-post-sig
___________________________________________________________________
Name: svn:ignore
- .metadata
.classpath
.settings
.project
target
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/sales-post-sig/src
___________________________________________________________________
Name: svn:ignore
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/sales-post-sig/src/main
___________________________________________________________________
Name: svn:ignore
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/sales-post-sig/src/main/resources
___________________________________________________________________
Name: svn:ignore
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/sales-post-sig/src/main/webapp
___________________________________________________________________
Name: svn:ignore
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/sales-post-sig/src/main/webapp/META-INF
___________________________________________________________________
Name: svn:ignore
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/sales-post-sig/src/main/webapp/WEB-INF
___________________________________________________________________
Name: svn:ignore
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/sales-post-sig/src/main/webapp/WEB-INF/lib
___________________________________________________________________
Name: svn:ignore
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/sales-sig
___________________________________________________________________
Name: svn:ignore
- .metadata
.classpath
.settings
.project
target
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/sales-sig/src
___________________________________________________________________
Name: svn:ignore
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/sales-sig/src/main
___________________________________________________________________
Name: svn:ignore
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/sales-sig/src/main/webapp
___________________________________________________________________
Name: svn:ignore
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/sales-sig/src/main/webapp/META-INF
___________________________________________________________________
Name: svn:ignore
- .metadata
.classpath
.settings
.project
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/sales-sig/src/main/webapp/WEB-INF
___________________________________________________________________
Name: svn:ignore
- .metadata
.classpath
.settings
.project
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/sales-standalone
___________________________________________________________________
Name: svn:ignore
- target
target-eclipse
eclipse-target
.settings
.project
.metadata
.classpath
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/sales-standalone/src
___________________________________________________________________
Name: svn:ignore
- target
target-eclipse
eclipse-target
.settings
.project
.metadata
.classpath
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/sales-standalone/src/main
___________________________________________________________________
Name: svn:ignore
- target
target-eclipse
eclipse-target
.settings
.project
.metadata
.classpath
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/sales-standalone/src/main/resources
___________________________________________________________________
Name: svn:ignore
- target
target-eclipse
eclipse-target
.settings
.project
.metadata
.classpath
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/sales-standalone/src/main/webapp
___________________________________________________________________
Name: svn:ignore
- target
target-eclipse
eclipse-target
.settings
.project
.metadata
.classpath
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/sales-standalone/src/main/webapp/META-INF
___________________________________________________________________
Name: svn:ignore
- target
target-eclipse
eclipse-target
.settings
.project
.metadata
.classpath
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/sales-standalone/src/main/webapp/WEB-INF
___________________________________________________________________
Name: svn:ignore
- target
target-eclipse
eclipse-target
.settings
.project
.metadata
.classpath
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/sales-standalone/src/main/webapp/WEB-INF/classes
___________________________________________________________________
Name: svn:ignore
- target
target-eclipse
eclipse-target
.settings
.project
.metadata
.classpath
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/seam-sp
___________________________________________________________________
Name: svn:ignore
- target
.classpath
.project
.settings
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/seam-sp/src
___________________________________________________________________
Name: svn:ignore
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/seam-sp/src/main
___________________________________________________________________
Name: svn:ignore
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/seam-sp/src/main/java
___________________________________________________________________
Name: svn:ignore
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/seam-sp/src/main/java/org
___________________________________________________________________
Name: svn:ignore
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/seam-sp/src/main/java/org/jboss
___________________________________________________________________
Name: svn:ignore
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/seam-sp/src/main/java/org/jboss/identity
___________________________________________________________________
Name: svn:ignore
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/seam-sp/src/main/java/org/jboss/identity/seam
___________________________________________________________________
Name: svn:ignore
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/seam-sp/src/main/java/org/jboss/identity/seam/federation
___________________________________________________________________
Name: svn:ignore
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/seam-sp/src/main/resources
___________________________________________________________________
Name: svn:ignore
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/seam-sp/src/main/webapp
___________________________________________________________________
Name: svn:ignore
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/seam-sp/src/main/webapp/META-INF
___________________________________________________________________
Name: svn:ignore
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
Property changes on: identity-federation/trunk/jboss-identity-webapps/seam-sp/src/main/webapp/WEB-INF
___________________________________________________________________
Name: svn:ignore
+ target
eclipse-target
target-eclipse
.project
.classpath
.metadata
.settings
16 years, 6 months
JBoss Identity SVN: r908 - in identity-federation/trunk: jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/servlets and 8 other directories.
by jboss-identity-commits@lists.jboss.org
Author: anil.saldhana(a)jboss.com
Date: 2009-11-06 12:28:15 -0500 (Fri, 06 Nov 2009)
New Revision: 908
Added:
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/interfaces/IMetadataProvider.java
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/md/
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/md/providers/
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/md/providers/AbstractMetadataProvider.java
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/md/providers/FileBasedEntitiesMetadataProvider.java
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/md/providers/FileBasedEntityMetadataProvider.java
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/md/providers/MetaDataBuilderDelegate.java
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/md/providers/SecurityActions.java
identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/servlets/saml/
identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/servlets/saml/MetadataServlet.java
identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/servlets/saml/SOAPSAMLXACMLServlet.java
identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/servlets/saml/SecurityActions.java
Removed:
identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/providers/AbstractMetadataProvider.java
identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/providers/FileBasedEntitiesMetadataProvider.java
identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/providers/FileBasedEntityMetadataProvider.java
identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/providers/IMetadataProvider.java
identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/providers/SecurityActions.java
identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/servlets/MetadataServlet.java
Modified:
identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/servlets/SOAPSAMLXACMLServlet.java
identity-federation/trunk/jboss-identity-fed-api/src/main/java/org/jboss/identity/federation/api/saml/v2/metadata/MetaDataBuilder.java
identity-federation/trunk/jboss-identity-webapps/metadata/resources/WEB-INF/web.xml
Log:
move classes out of bindings into core/web
Deleted: identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/providers/AbstractMetadataProvider.java
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/providers/AbstractMetadataProvider.java 2009-11-05 19:23:37 UTC (rev 907)
+++ identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/providers/AbstractMetadataProvider.java 2009-11-06 17:28:15 UTC (rev 908)
@@ -1,43 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.identity.federation.bindings.providers;
-
-import java.util.Map;
-
-/**
- * Abstract Metadata provider
- * @author Anil.Saldhana(a)redhat.com
- * @since Apr 21, 2009
- */
-public abstract class AbstractMetadataProvider
-{
- protected Map<String, String> options;
-
- /**
- * @see IMetadataProvider#init(Map)
- * @param options
- */
- public void init(Map<String,String> options)
- {
- this.options = options;
- }
-}
\ No newline at end of file
Deleted: identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/providers/FileBasedEntitiesMetadataProvider.java
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/providers/FileBasedEntitiesMetadataProvider.java 2009-11-05 19:23:37 UTC (rev 907)
+++ identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/providers/FileBasedEntitiesMetadataProvider.java 2009-11-06 17:28:15 UTC (rev 908)
@@ -1,63 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.identity.federation.bindings.providers;
-
-import java.io.InputStream;
-import java.security.PublicKey;
-
-import org.jboss.identity.federation.saml.v2.metadata.EntitiesDescriptorType;
-
-/**
- * File based provider that handles multiple entities
- * @author Anil.Saldhana(a)redhat.com
- * @since Apr 21, 2009
- */
-public class FileBasedEntitiesMetadataProvider extends AbstractMetadataProvider
-implements IMetadataProvider<EntitiesDescriptorType>
-{
- public EntitiesDescriptorType getMetaData()
- {
- throw new RuntimeException("NYI");
- }
-
- public boolean isMultiple()
- {
- return true;
- }
-
- public void injectEncryptionKey(PublicKey publicKey)
- {
- }
-
- public void injectFileStream(InputStream fileStream)
- {
- }
-
- public void injectSigningKey(PublicKey publicKey)
- {
- }
-
- public String requireFileInjection()
- {
- return null;
- }
-}
\ No newline at end of file
Deleted: identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/providers/FileBasedEntityMetadataProvider.java
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/providers/FileBasedEntityMetadataProvider.java 2009-11-05 19:23:37 UTC (rev 907)
+++ identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/providers/FileBasedEntityMetadataProvider.java 2009-11-06 17:28:15 UTC (rev 908)
@@ -1,112 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.identity.federation.bindings.providers;
-
-import java.io.InputStream;
-import java.security.PublicKey;
-import java.util.Map;
-
-import javax.xml.bind.JAXBElement;
-
-import org.jboss.identity.federation.api.saml.v2.metadata.MetaDataBuilder;
-import org.jboss.identity.federation.saml.v2.metadata.EntityDescriptorType;
-
-/**
- * A file based metadata provider that
- * just looks for the passed in file name
- * @author Anil.Saldhana(a)redhat.com
- * @since Apr 21, 2009
- */
-public class FileBasedEntityMetadataProvider extends AbstractMetadataProvider
-implements IMetadataProvider<EntityDescriptorType>
-{
-
- private static final String FILENAME_KEY = "FileName";
- private String fileName;
- private InputStream metadataFileStream;
- @SuppressWarnings("unused")
- private PublicKey encryptionKey;
- @SuppressWarnings("unused")
- private PublicKey signingKey;
-
- @Override
- public void init(Map<String, String> options)
- {
- super.init(options);
- fileName = options.get(FILENAME_KEY);
- if(fileName == null)
- throw new IllegalStateException("FileName option not set");
- }
-
- /**
- * @see IMetadataProvider#getMetaData()
- */
- @SuppressWarnings("unchecked")
- public EntityDescriptorType getMetaData()
- {
- EntityDescriptorType edt = null;
-
- if(this.metadataFileStream == null)
- throw new RuntimeException("Metadata file is not injected");
-
- try
- {
- JAXBElement<EntityDescriptorType> j =
- (JAXBElement<EntityDescriptorType>) MetaDataBuilder.getUnmarshaller().unmarshal(metadataFileStream);
- edt = j.getValue();
- //TODO: use the signing and enc key data
- }
- catch(Exception e)
- {
- throw new RuntimeException(e);
- }
- return edt;
- }
-
- /**
- * @see IMetadataProvider#isMultiple()
- */
- public boolean isMultiple()
- {
- return false;
- }
-
- public void injectEncryptionKey(PublicKey publicKey)
- {
- this.encryptionKey = publicKey;
- }
-
- public void injectFileStream(InputStream fileStream)
- {
- this.metadataFileStream = fileStream;
- }
-
- public void injectSigningKey(PublicKey publicKey)
- {
- this.signingKey = publicKey;
- }
-
- public String requireFileInjection()
- {
- return this.fileName;
- }
-}
\ No newline at end of file
Deleted: identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/providers/IMetadataProvider.java
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/providers/IMetadataProvider.java 2009-11-05 19:23:37 UTC (rev 907)
+++ identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/providers/IMetadataProvider.java 2009-11-06 17:28:15 UTC (rev 908)
@@ -1,78 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.identity.federation.bindings.providers;
-
-import java.io.InputStream;
-import java.security.PublicKey;
-import java.util.Map;
-
-/**
- * MetadataProvider
- * @author Anil.Saldhana(a)redhat.com
- * @since Apr 21, 2009
- */
-public interface IMetadataProvider<T>
-{
- /**
- * Initialize the provider with options
- * @param options
- */
- void init(Map<String,String> options);
-
- /**
- * Is multiple descriptors attached?
- * @return
- */
- boolean isMultiple();
-
- /**
- * Get the Metadata descriptors
- * @return
- */
- T getMetaData();
-
- /**
- * Provider indicates that it requires
- * an injection of File instance
- * @return File Name (need injection) or null
- */
- String requireFileInjection();
-
- /**
- * Inject a File instance depending on
- * @see #requireFileInjection() method
- * @param fileStream
- */
- void injectFileStream(InputStream fileStream);
-
- /**
- * Inject a public key used for signing
- * @param publicKey
- */
- void injectSigningKey(PublicKey publicKey);
-
- /**
- * Inject a public key used for encryption
- * @param publicKey
- */
- void injectEncryptionKey(PublicKey publicKey);
-}
\ No newline at end of file
Deleted: identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/providers/SecurityActions.java
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/providers/SecurityActions.java 2009-11-05 19:23:37 UTC (rev 907)
+++ identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/providers/SecurityActions.java 2009-11-06 17:28:15 UTC (rev 908)
@@ -1,57 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.identity.federation.bindings.providers;
-
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-
-/**
- * Privileged Blocks
- * @author Anil.Saldhana(a)redhat.com
- * @since Mar 17, 2009
- */
-class SecurityActions
-{
- static void setSystemProperty( final String key, final String value)
- {
- AccessController.doPrivileged(new PrivilegedAction<Object>()
- {
- public Object run()
- {
- System.setProperty(key, value);
- return null;
- }
- });
- }
-
- static ClassLoader getContextClassLoader()
- {
- return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>()
- {
- public ClassLoader run()
- {
- return Thread.currentThread().getContextClassLoader();
- }
- });
- }
-
-}
\ No newline at end of file
Deleted: identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/servlets/MetadataServlet.java
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/servlets/MetadataServlet.java 2009-11-05 19:23:37 UTC (rev 907)
+++ identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/servlets/MetadataServlet.java 2009-11-06 17:28:15 UTC (rev 908)
@@ -1,202 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.identity.federation.bindings.servlets;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.security.cert.Certificate;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletContext;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.xml.bind.JAXBElement;
-
-import org.apache.log4j.Logger;
-import org.jboss.identity.federation.api.saml.v2.metadata.KeyDescriptorMetaDataBuilder;
-import org.jboss.identity.federation.api.saml.v2.metadata.MetaDataBuilder;
-import org.jboss.identity.federation.api.util.KeyUtil;
-import org.jboss.identity.federation.bindings.providers.IMetadataProvider;
-import org.jboss.identity.federation.core.config.KeyProviderType;
-import org.jboss.identity.federation.core.config.KeyValueType;
-import org.jboss.identity.federation.core.config.MetadataProviderType;
-import org.jboss.identity.federation.core.config.ProviderType;
-import org.jboss.identity.federation.core.interfaces.TrustKeyManager;
-import org.jboss.identity.federation.core.saml.v2.constants.JBossSAMLConstants;
-import org.jboss.identity.federation.core.util.XMLEncryptionUtil;
-import org.jboss.identity.federation.saml.v2.metadata.EntityDescriptorType;
-import org.jboss.identity.federation.saml.v2.metadata.KeyDescriptorType;
-import org.jboss.identity.federation.saml.v2.metadata.RoleDescriptorType;
-import org.jboss.identity.federation.web.constants.GeneralConstants;
-import org.jboss.identity.federation.web.util.ConfigurationUtil;
-import org.jboss.identity.xmlsec.w3.xmldsig.KeyInfoType;
-
-
-import static org.jboss.identity.federation.core.util.StringUtil.isNotNull;
-
-/**
- * Metadata servlet for the IDP/SP
- * @author Anil.Saldhana(a)redhat.com
- * @since Apr 22, 2009
- */
-public class MetadataServlet extends HttpServlet
-{
- private static final long serialVersionUID = 1L;
- private static Logger log = Logger.getLogger(MetadataServlet.class);
- private boolean trace = log.isTraceEnabled();
-
- private String configFileLocation = GeneralConstants.CONFIG_FILE_LOCATION;
- private transient MetadataProviderType metadataProviderType = null;
-
- private transient IMetadataProvider<?> metadataProvider = null;
-
- private transient EntityDescriptorType metadata;
-
- private String signingAlias = null;
- private String encryptingAlias = null;
- private TrustKeyManager keyManager;
-
- @SuppressWarnings("unchecked")
- @Override
- public void init(ServletConfig config) throws ServletException
- {
- super.init(config);
- try
- {
- ServletContext context = config.getServletContext();
- String configL = config.getInitParameter("configFile");
- if(isNotNull(configL))
- configFileLocation = configL;
- if(trace)
- log.trace("Config File Location="+ configFileLocation);
- InputStream is = context.getResourceAsStream(configFileLocation);
- if(is == null)
- throw new RuntimeException(configFileLocation + " missing");
-
- //Look for signing alias
- signingAlias = config.getInitParameter("signingAlias");
- encryptingAlias = config.getInitParameter("encryptingAlias");
-
- ProviderType providerType = ConfigurationUtil.getIDPConfiguration(is);
- metadataProviderType = providerType.getMetaDataProvider();
- String fqn = metadataProviderType.getClassName();
- ClassLoader tcl = SecurityActions.getContextClassLoader();
- Class<?> clazz = tcl.loadClass(fqn);
- metadataProvider = (IMetadataProvider) clazz.newInstance();
- List<KeyValueType> keyValues = metadataProviderType.getOption();
- Map<String,String> options = new HashMap<String,String>();
- if(keyValues != null)
- {
- for(KeyValueType kvt: keyValues)
- options.put(kvt.getKey(), kvt.getValue());
- }
- metadataProvider.init(options);
- if(metadataProvider.isMultiple())
- throw new RuntimeException("Multiple Entities not currently supported");
-
- /**
- * Since a metadata provider does not have access to the servlet context.
- * It may be difficult to get to the resource from the TCL.
- */
- String fileInjectionStr = metadataProvider.requireFileInjection();
- if(isNotNull(fileInjectionStr))
- {
- metadataProvider.injectFileStream(context.getResourceAsStream(fileInjectionStr));
- }
-
- metadata = (EntityDescriptorType) metadataProvider.getMetaData();
-
- //Get the trust manager information
- KeyProviderType keyProvider = providerType.getKeyProvider();
- signingAlias = keyProvider.getSigningAlias();
- String keyManagerClassName = keyProvider.getClassName();
- if(keyManagerClassName == null)
- throw new RuntimeException("KeyManager class name is null");
-
- clazz = tcl.loadClass(keyManagerClassName);
- this.keyManager = (TrustKeyManager) clazz.newInstance();
- keyManager.setAuthProperties(keyProvider.getAuth());
-
- Certificate cert = keyManager.getCertificate(signingAlias);
- KeyInfoType keyInfo = KeyUtil.getKeyInfo(cert);
-
- //TODO: Assume just signing key for now
- KeyDescriptorType keyDescriptor = KeyDescriptorMetaDataBuilder.createKeyDescriptor(keyInfo,
- null, 0, true, false);
-
- updateKeyDescriptor(metadata, keyDescriptor);
-
- //encryption
- if(this.encryptingAlias != null)
- {
- cert = keyManager.getCertificate(encryptingAlias);
- keyInfo = KeyUtil.getKeyInfo(cert);
- String certAlgo = cert.getPublicKey().getAlgorithm();
- keyDescriptor = KeyDescriptorMetaDataBuilder.createKeyDescriptor(keyInfo,
- XMLEncryptionUtil.getEncryptionURL(certAlgo),
- XMLEncryptionUtil.getEncryptionKeySize(certAlgo), false, true);
- updateKeyDescriptor(metadata, keyDescriptor);
- }
- } catch(Exception e)
- {
- log.error("Exception in starting servlet:",e);
- throw new ServletException("Unable to start servlet");
- }
-
- }
-
-
- @Override
- protected void doGet(HttpServletRequest req, HttpServletResponse resp)
- throws ServletException, IOException
- {
- resp.setContentType(JBossSAMLConstants.METADATA_MIME.get());
- OutputStream os = resp.getOutputStream();
- JAXBElement<?> jaxbEl = MetaDataBuilder.getObjectFactory().createEntityDescriptor(metadata);
- try
- {
- MetaDataBuilder.getMarshaller().marshal(jaxbEl , os);
- }
- catch (Exception e)
- {
- throw new RuntimeException(e);
- }
- }
-
- private void updateKeyDescriptor(EntityDescriptorType entityD, KeyDescriptorType keyD)
- {
- List<RoleDescriptorType> objs = entityD.getRoleDescriptorOrIDPSSODescriptorOrSPSSODescriptor();
- if(objs != null)
- {
- for(RoleDescriptorType roleD: objs)
- {
- roleD.getKeyDescriptor().add(keyD);
- }
- }
- }
-}
\ No newline at end of file
Modified: identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/servlets/SOAPSAMLXACMLServlet.java
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/servlets/SOAPSAMLXACMLServlet.java 2009-11-05 19:23:37 UTC (rev 907)
+++ identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/servlets/SOAPSAMLXACMLServlet.java 2009-11-06 17:28:15 UTC (rev 908)
@@ -21,267 +21,14 @@
*/
package org.jboss.identity.federation.bindings.servlets;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.security.PrivilegedActionException;
-import java.util.ArrayList;
-import java.util.List;
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.xml.bind.JAXBElement;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Marshaller;
-import javax.xml.bind.Unmarshaller;
-import javax.xml.bind.helpers.DefaultValidationEventHandler;
-
-import org.apache.log4j.Logger;
-import org.jboss.identity.federation.api.saml.v2.response.SAML2Response;
-import org.jboss.identity.federation.core.factories.SOAPFactory;
-import org.jboss.identity.federation.core.factories.XACMLContextFactory;
-import org.jboss.identity.federation.core.saml.v2.common.IDGenerator;
-import org.jboss.identity.federation.core.saml.v2.factories.SAMLAssertionFactory;
-import org.jboss.identity.federation.core.saml.v2.holders.IssuerInfoHolder;
-import org.jboss.identity.federation.core.saml.v2.util.DocumentUtil;
-import org.jboss.identity.federation.core.saml.v2.util.JAXBElementMappingUtil;
-import org.jboss.identity.federation.core.saml.v2.util.SOAPSAMLXACMLUtil;
-import org.jboss.identity.federation.core.saml.v2.util.XMLTimeUtil;
-import org.jboss.identity.federation.core.util.JAXBUtil;
-import org.jboss.identity.federation.org.xmlsoap.schemas.soap.envelope.Body;
-import org.jboss.identity.federation.org.xmlsoap.schemas.soap.envelope.Envelope;
-import org.jboss.identity.federation.org.xmlsoap.schemas.soap.envelope.Fault;
-import org.jboss.identity.federation.saml.v2.assertion.AssertionType;
-import org.jboss.identity.federation.saml.v2.assertion.StatementAbstractType;
-import org.jboss.identity.federation.saml.v2.profiles.xacml.assertion.XACMLAuthzDecisionStatementType;
-import org.jboss.identity.federation.saml.v2.profiles.xacml.protocol.XACMLAuthzDecisionQueryType;
-import org.jboss.identity.federation.saml.v2.protocol.RequestAbstractType;
-import org.jboss.security.xacml.core.JBossPDP;
-import org.jboss.security.xacml.core.JBossRequestContext;
-import org.jboss.security.xacml.core.model.context.RequestType;
-import org.jboss.security.xacml.core.model.context.ResponseType;
-import org.jboss.security.xacml.core.model.context.ResultType;
-import org.jboss.security.xacml.interfaces.PolicyDecisionPoint;
-import org.jboss.security.xacml.interfaces.RequestContext;
-import org.jboss.security.xacml.interfaces.ResponseContext;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
/**
* Servlet that can read SOAP 1.1 messages that contain
* an XACML query in saml payload
* @author Anil.Saldhana(a)redhat.com
* @since Jan 27, 2009
*/
-public class SOAPSAMLXACMLServlet extends HttpServlet
-{
- private static Logger log = Logger.getLogger(SOAPSAMLXACMLServlet.class);
- private boolean trace = log.isTraceEnabled();
-
- private static final long serialVersionUID = 1L;
-
- private String policyConfigFileName = null;
-
- private String issuerId = null;
- private String issuer = null;
-
- boolean debug = false;
-
- private transient PolicyDecisionPoint pdp = null;
-
- public void init(ServletConfig config) throws ServletException
- {
- issuerId = config.getInitParameter("issuerID");
- if(issuerId == null)
- issuerId = "issue-id:1";
-
- issuer = config.getInitParameter("issuer");
- if(issuer == null)
- issuer = "urn:jboss-identity";
-
- policyConfigFileName = config.getInitParameter("policyConfigFileName");
- if(policyConfigFileName == null)
- policyConfigFileName = "policyConfig.xml";
-
- String debugStr = config.getInitParameter("debug");
- try
- {
- debug = Boolean.parseBoolean(debugStr);
- }
- catch(Exception ignore)
- {
- debug = false;
- }
-
- if(trace)
- {
- log.trace("Issuer=" + issuer + " :: issuerID=" + issuerId);
- log.trace("PolicyConfig File:" + policyConfigFileName);
- log.trace("Debug="+debug);
- }
-
- if(debug)
- {
- SecurityActions.setSystemProperty("jaxb.debug", "true");
- }
-
- try
- {
- pdp = this.getPDP();
- }
- catch (PrivilegedActionException e)
- {
- log("Exception loading PDP::",e);
- throw new ServletException("Unable to load PDP");
- }
- super.init(config);
- }
-
-
- @SuppressWarnings("unchecked")
- @Override
- protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
- {
- JAXBElement<RequestAbstractType> jaxbRequestType = null;
-
- Envelope envelope = null;
- XACMLAuthzDecisionQueryType xacmlRequest = null;
-
- try
- {
- Document inputDoc = DocumentUtil.getDocument(req.getInputStream());
- if(debug && trace)
- log.trace("Received SOAP:"+DocumentUtil.getDocumentAsString(inputDoc));
-
- Unmarshaller un = JAXBUtil.getUnmarshaller(SOAPSAMLXACMLUtil.getPackage());
- if(debug)
- un.setEventHandler(new DefaultValidationEventHandler());
-
- Object unmarshalledObject = un.unmarshal(DocumentUtil.getNodeAsStream(inputDoc));
-
- if(unmarshalledObject instanceof JAXBElement)
- {
- JAXBElement<?> jaxbElement = (JAXBElement<?>) unmarshalledObject;
- Object element = jaxbElement.getValue();
- if(element instanceof Envelope)
- {
- envelope = (Envelope)element;
- Body soapBody = envelope.getBody();
- Object samlRequest = soapBody.getAny().get(0);
- if(samlRequest instanceof JAXBElement)
- {
- jaxbRequestType = (JAXBElement<RequestAbstractType>)samlRequest;
- jaxbRequestType = (JAXBElement<RequestAbstractType>)samlRequest;
- xacmlRequest = (XACMLAuthzDecisionQueryType) jaxbRequestType.getValue();
- }
- else
- if(samlRequest instanceof Element)
- {
- Element elem = (Element) samlRequest;
- xacmlRequest = SOAPSAMLXACMLUtil.getXACMLQueryType(elem);
- }
- }
- else if(element instanceof XACMLAuthzDecisionQueryType)
- {
- xacmlRequest = (XACMLAuthzDecisionQueryType) element;
- }
- }
- if(xacmlRequest == null)
- throw new IOException("XACML Request not parsed");
-
- RequestType requestType = xacmlRequest.getRequest();
-
- RequestContext requestContext = new JBossRequestContext();
- requestContext.setRequest(requestType);
-
- //pdp evaluation is thread safe
- ResponseContext responseContext = pdp.evaluate(requestContext);
-
- ResponseType responseType = new ResponseType();
- ResultType resultType = responseContext.getResult();
- responseType.getResult().add(resultType);
-
- XACMLAuthzDecisionStatementType xacmlStatement =
- XACMLContextFactory.createXACMLAuthzDecisionStatementType(requestType, responseType);
-
- //Place the xacml statement in an assertion
- //Then the assertion goes inside a SAML Response
-
- String ID = IDGenerator.create("ID_");
- SAML2Response saml2Response = new SAML2Response();
- IssuerInfoHolder issuerInfo = new IssuerInfoHolder(this.issuer);
-
- List<StatementAbstractType> statements = new ArrayList<StatementAbstractType>();
- statements.add(xacmlStatement);
-
- AssertionType assertion = SAMLAssertionFactory.createAssertion(ID,
- issuerInfo.getIssuer(),
- XMLTimeUtil.getIssueInstant(),
- null,
- null,
- statements);
-
- JAXBElement<?> jaxbResponse = JAXBElementMappingUtil.get(saml2Response.createResponseType(ID, issuerInfo, assertion));
-
- //Create a SOAP Envelope to hold the SAML response
- envelope = this.createEnvelope(jaxbResponse);
- }
- catch (JAXBException e)
- {
- String id = IDGenerator.create();
- log.error(id + "::Exception parsing SOAP:", e);
- envelope = this.createEnvelope(this.createFault("Parsing Error. Reference::" + id));
- }
- catch (Exception e)
- {
- String id = IDGenerator.create();
- log.error(id + "::Exception:", e);
- envelope = this.createEnvelope(this.createFault("Server Error. Reference::" + id));
- }
- finally
- {
- resp.setContentType("text/xml;charset=utf-8");;
- OutputStream os = resp.getOutputStream();
- try
- {
- if(envelope == null)
- throw new IllegalStateException("SOAPEnvelope is null");
- JAXBElement<?> jaxbEnvelope = JAXBElementMappingUtil.get(envelope);
- Marshaller marshaller = JAXBUtil.getMarshaller(SOAPSAMLXACMLUtil.getPackage());
- marshaller.marshal(jaxbEnvelope, os);
- }
- catch (JAXBException e)
- {
- log("marshalling exception",e);
- }
- }
- }
-
- private PolicyDecisionPoint getPDP() throws PrivilegedActionException
- {
- ClassLoader tcl = SecurityActions.getContextClassLoader();
- InputStream is = tcl.getResourceAsStream(this.policyConfigFileName);
- if(is == null)
- throw new IllegalStateException(policyConfigFileName + " could not be located");
- return new JBossPDP(is);
- }
-
- private Envelope createEnvelope(Object obj)
- {
- Envelope envelope = SOAPFactory.getObjectFactory().createEnvelope();
- Body body = SOAPFactory.getObjectFactory().createBody();
- body.getAny().add(obj);
- envelope.setBody(body);
- return envelope;
- }
-
- private JAXBElement<Fault> createFault(String msg)
- {
- Fault fault = SOAPFactory.getObjectFactory().createFault();
- fault.setFaultstring(msg);
- return SOAPFactory.getObjectFactory().createFault(fault);
- }
+public class SOAPSAMLXACMLServlet extends org.jboss.identity.federation.web.servlets.saml.SOAPSAMLXACMLServlet
+{
+ private static final long serialVersionUID = 1L;
}
\ No newline at end of file
Modified: identity-federation/trunk/jboss-identity-fed-api/src/main/java/org/jboss/identity/federation/api/saml/v2/metadata/MetaDataBuilder.java
===================================================================
--- identity-federation/trunk/jboss-identity-fed-api/src/main/java/org/jboss/identity/federation/api/saml/v2/metadata/MetaDataBuilder.java 2009-11-05 19:23:37 UTC (rev 907)
+++ identity-federation/trunk/jboss-identity-fed-api/src/main/java/org/jboss/identity/federation/api/saml/v2/metadata/MetaDataBuilder.java 2009-11-06 17:28:15 UTC (rev 908)
@@ -27,15 +27,12 @@
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
-import org.jboss.identity.federation.core.saml.v2.constants.JBossSAMLConstants;
-import org.jboss.identity.federation.core.util.JAXBUtil;
+import org.jboss.identity.federation.core.saml.md.providers.MetaDataBuilderDelegate;
import org.jboss.identity.federation.saml.v2.assertion.AttributeType;
import org.jboss.identity.federation.saml.v2.metadata.EndpointType;
import org.jboss.identity.federation.saml.v2.metadata.EntityDescriptorType;
import org.jboss.identity.federation.saml.v2.metadata.IDPSSODescriptorType;
import org.jboss.identity.federation.saml.v2.metadata.KeyDescriptorType;
-import org.jboss.identity.federation.saml.v2.metadata.LocalizedNameType;
-import org.jboss.identity.federation.saml.v2.metadata.LocalizedURIType;
import org.jboss.identity.federation.saml.v2.metadata.ObjectFactory;
import org.jboss.identity.federation.saml.v2.metadata.OrganizationType;
import org.jboss.identity.federation.saml.v2.metadata.SPSSODescriptorType;
@@ -47,10 +44,7 @@
* @since Apr 19, 2009
*/
public class MetaDataBuilder
-{
- private static ObjectFactory oFact = new ObjectFactory();
-
- private static String pkgName = "org.jboss.identity.federation.saml.v2.metadata";
+{
/**
* Create an Endpoint (SingleSignOnEndpoint or SingleLogoutEndpoint)
* @param binding
@@ -61,11 +55,7 @@
public static EndpointType createEndpoint(String binding, String location,
String responseLocation)
{
- EndpointType endpoint = oFact.createEndpointType();
- endpoint.setBinding(binding);
- endpoint.setLocation(location);
- endpoint.setResponseLocation(responseLocation);
- return endpoint;
+ return MetaDataBuilderDelegate.createEndpoint(binding, location, responseLocation);
}
/**
@@ -79,35 +69,7 @@
public static OrganizationType createOrganization(String organizationName,
String organizationDisplayName, String organizationURL, String lang)
{
- if(organizationName == null)
- throw new IllegalArgumentException("organizationName is null");
- if(organizationDisplayName == null)
- throw new IllegalArgumentException("organizationDisplayName is null");
- if(organizationURL == null)
- throw new IllegalArgumentException("organizationURL is null");
- if(lang == null)
- lang = JBossSAMLConstants.LANG_EN.get();
-
- //orgName
- LocalizedNameType orgName = oFact.createLocalizedNameType();
- orgName.setValue(organizationName);
- orgName.setLang(lang);
-
- //orgDisplayName
- LocalizedNameType orgDisplayName = oFact.createLocalizedNameType();
- orgDisplayName.setValue(organizationDisplayName);
- orgDisplayName.setLang(lang);
-
- //orgURL
- LocalizedURIType orgURL = oFact.createLocalizedURIType();
- orgURL.setValue(organizationURL);
- orgURL.setLang(lang);
-
- OrganizationType orgType = oFact.createOrganizationType();
- orgType.getOrganizationName().add(orgName);
- orgType.getOrganizationDisplayName().add(orgDisplayName);
- orgType.getOrganizationURL().add(orgURL);
- return orgType;
+ return MetaDataBuilderDelegate.createOrganization(organizationName, organizationDisplayName, organizationURL, lang);
}
/**
@@ -117,9 +79,7 @@
*/
public static EntityDescriptorType createEntityDescriptor(SSODescriptorType idpOrSPDescriptor)
{
- EntityDescriptorType entity = oFact.createEntityDescriptorType();
- entity.getRoleDescriptorOrIDPSSODescriptorOrSPSSODescriptor().add(idpOrSPDescriptor);
- return entity;
+ return MetaDataBuilderDelegate.createEntityDescriptor(idpOrSPDescriptor);
}
/**
@@ -139,14 +99,8 @@
List<AttributeType> attributes,
OrganizationType org)
{
- IDPSSODescriptorType idp = oFact.createIDPSSODescriptorType();
- idp.getSingleSignOnService().add(ssoEndPoint);
- idp.getSingleLogoutService().add(sloEndPoint);
- idp.getAttribute().addAll(attributes);
- idp.getKeyDescriptor().add(keyDescriptorType);
- idp.setWantAuthnRequestsSigned(requestsSigned);
- idp.setOrganization(org);
- return idp;
+ return MetaDataBuilderDelegate.createIDPSSODescriptor(requestsSigned,
+ keyDescriptorType, ssoEndPoint, sloEndPoint, attributes, org);
}
/**
@@ -165,12 +119,8 @@
List<AttributeType> attributes,
OrganizationType org)
{
- SPSSODescriptorType sp = oFact.createSPSSODescriptorType();
- sp.getSingleLogoutService().add(sloEndPoint);
- sp.getKeyDescriptor().add(keyDescriptorType);
- sp.setAuthnRequestsSigned(requestsSigned);
- sp.setOrganization(org);
- return sp;
+ return MetaDataBuilderDelegate.createSPSSODescriptor(requestsSigned, keyDescriptorType,
+ sloEndPoint, attributes, org);
}
/**
@@ -180,7 +130,7 @@
*/
public static Marshaller getMarshaller() throws JAXBException
{
- return JAXBUtil.getMarshaller(pkgName);
+ return MetaDataBuilderDelegate.getMarshaller();
}
/**
@@ -190,7 +140,7 @@
*/
public static Unmarshaller getUnmarshaller() throws JAXBException
{
- return JAXBUtil.getUnmarshaller(pkgName);
+ return MetaDataBuilderDelegate.getUnmarshaller();
}
/**
@@ -199,6 +149,6 @@
*/
public static ObjectFactory getObjectFactory()
{
- return oFact;
+ return MetaDataBuilderDelegate.getObjectFactory();
}
}
\ No newline at end of file
Added: identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/interfaces/IMetadataProvider.java
===================================================================
--- identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/interfaces/IMetadataProvider.java (rev 0)
+++ identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/interfaces/IMetadataProvider.java 2009-11-06 17:28:15 UTC (rev 908)
@@ -0,0 +1,78 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.identity.federation.core.interfaces;
+
+import java.io.InputStream;
+import java.security.PublicKey;
+import java.util.Map;
+
+/**
+ * MetadataProvider
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Apr 21, 2009
+ */
+public interface IMetadataProvider<T>
+{
+ /**
+ * Initialize the provider with options
+ * @param options
+ */
+ void init(Map<String,String> options);
+
+ /**
+ * Is multiple descriptors attached?
+ * @return
+ */
+ boolean isMultiple();
+
+ /**
+ * Get the Metadata descriptors
+ * @return
+ */
+ T getMetaData();
+
+ /**
+ * Provider indicates that it requires
+ * an injection of File instance
+ * @return File Name (need injection) or null
+ */
+ String requireFileInjection();
+
+ /**
+ * Inject a File instance depending on
+ * @see #requireFileInjection() method
+ * @param fileStream
+ */
+ void injectFileStream(InputStream fileStream);
+
+ /**
+ * Inject a public key used for signing
+ * @param publicKey
+ */
+ void injectSigningKey(PublicKey publicKey);
+
+ /**
+ * Inject a public key used for encryption
+ * @param publicKey
+ */
+ void injectEncryptionKey(PublicKey publicKey);
+}
\ No newline at end of file
Added: identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/md/providers/AbstractMetadataProvider.java
===================================================================
--- identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/md/providers/AbstractMetadataProvider.java (rev 0)
+++ identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/md/providers/AbstractMetadataProvider.java 2009-11-06 17:28:15 UTC (rev 908)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.identity.federation.core.saml.md.providers;
+
+import java.util.Map;
+
+/**
+ * Abstract Metadata provider
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Apr 21, 2009
+ */
+public abstract class AbstractMetadataProvider
+{
+ protected Map<String, String> options;
+
+ /**
+ * @see IMetadataProvider#init(Map)
+ * @param options
+ */
+ public void init(Map<String,String> options)
+ {
+ this.options = options;
+ }
+}
\ No newline at end of file
Added: identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/md/providers/FileBasedEntitiesMetadataProvider.java
===================================================================
--- identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/md/providers/FileBasedEntitiesMetadataProvider.java (rev 0)
+++ identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/md/providers/FileBasedEntitiesMetadataProvider.java 2009-11-06 17:28:15 UTC (rev 908)
@@ -0,0 +1,64 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.identity.federation.core.saml.md.providers;
+
+import java.io.InputStream;
+import java.security.PublicKey;
+
+import org.jboss.identity.federation.core.interfaces.IMetadataProvider;
+import org.jboss.identity.federation.saml.v2.metadata.EntitiesDescriptorType;
+
+/**
+ * File based provider that handles multiple entities
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Apr 21, 2009
+ */
+public class FileBasedEntitiesMetadataProvider extends AbstractMetadataProvider
+implements IMetadataProvider<EntitiesDescriptorType>
+{
+ public EntitiesDescriptorType getMetaData()
+ {
+ throw new RuntimeException("NYI");
+ }
+
+ public boolean isMultiple()
+ {
+ return true;
+ }
+
+ public void injectEncryptionKey(PublicKey publicKey)
+ {
+ }
+
+ public void injectFileStream(InputStream fileStream)
+ {
+ }
+
+ public void injectSigningKey(PublicKey publicKey)
+ {
+ }
+
+ public String requireFileInjection()
+ {
+ return null;
+ }
+}
\ No newline at end of file
Added: identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/md/providers/FileBasedEntityMetadataProvider.java
===================================================================
--- identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/md/providers/FileBasedEntityMetadataProvider.java (rev 0)
+++ identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/md/providers/FileBasedEntityMetadataProvider.java 2009-11-06 17:28:15 UTC (rev 908)
@@ -0,0 +1,112 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.identity.federation.core.saml.md.providers;
+
+import java.io.InputStream;
+import java.security.PublicKey;
+import java.util.Map;
+
+import javax.xml.bind.JAXBElement;
+
+import org.jboss.identity.federation.core.interfaces.IMetadataProvider;
+import org.jboss.identity.federation.saml.v2.metadata.EntityDescriptorType;
+
+/**
+ * A file based metadata provider that
+ * just looks for the passed in file name
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Apr 21, 2009
+ */
+public class FileBasedEntityMetadataProvider extends AbstractMetadataProvider
+implements IMetadataProvider<EntityDescriptorType>
+{
+
+ private static final String FILENAME_KEY = "FileName";
+ private String fileName;
+ private InputStream metadataFileStream;
+ @SuppressWarnings("unused")
+ private PublicKey encryptionKey;
+ @SuppressWarnings("unused")
+ private PublicKey signingKey;
+
+ @Override
+ public void init(Map<String, String> options)
+ {
+ super.init(options);
+ fileName = options.get(FILENAME_KEY);
+ if(fileName == null)
+ throw new IllegalStateException("FileName option not set");
+ }
+
+ /**
+ * @see IMetadataProvider#getMetaData()
+ */
+ @SuppressWarnings("unchecked")
+ public EntityDescriptorType getMetaData()
+ {
+ EntityDescriptorType edt = null;
+
+ if(this.metadataFileStream == null)
+ throw new RuntimeException("Metadata file is not injected");
+
+ try
+ {
+ JAXBElement<EntityDescriptorType> j =
+ (JAXBElement<EntityDescriptorType>) MetaDataBuilderDelegate.getUnmarshaller().unmarshal(metadataFileStream);
+ edt = j.getValue();
+ //TODO: use the signing and enc key data
+ }
+ catch(Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ return edt;
+ }
+
+ /**
+ * @see IMetadataProvider#isMultiple()
+ */
+ public boolean isMultiple()
+ {
+ return false;
+ }
+
+ public void injectEncryptionKey(PublicKey publicKey)
+ {
+ this.encryptionKey = publicKey;
+ }
+
+ public void injectFileStream(InputStream fileStream)
+ {
+ this.metadataFileStream = fileStream;
+ }
+
+ public void injectSigningKey(PublicKey publicKey)
+ {
+ this.signingKey = publicKey;
+ }
+
+ public String requireFileInjection()
+ {
+ return this.fileName;
+ }
+}
\ No newline at end of file
Added: identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/md/providers/MetaDataBuilderDelegate.java
===================================================================
--- identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/md/providers/MetaDataBuilderDelegate.java (rev 0)
+++ identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/md/providers/MetaDataBuilderDelegate.java 2009-11-06 17:28:15 UTC (rev 908)
@@ -0,0 +1,204 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.identity.federation.core.saml.md.providers;
+
+import java.util.List;
+
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+
+import org.jboss.identity.federation.core.saml.v2.constants.JBossSAMLConstants;
+import org.jboss.identity.federation.core.util.JAXBUtil;
+import org.jboss.identity.federation.saml.v2.assertion.AttributeType;
+import org.jboss.identity.federation.saml.v2.metadata.EndpointType;
+import org.jboss.identity.federation.saml.v2.metadata.EntityDescriptorType;
+import org.jboss.identity.federation.saml.v2.metadata.IDPSSODescriptorType;
+import org.jboss.identity.federation.saml.v2.metadata.KeyDescriptorType;
+import org.jboss.identity.federation.saml.v2.metadata.LocalizedNameType;
+import org.jboss.identity.federation.saml.v2.metadata.LocalizedURIType;
+import org.jboss.identity.federation.saml.v2.metadata.ObjectFactory;
+import org.jboss.identity.federation.saml.v2.metadata.OrganizationType;
+import org.jboss.identity.federation.saml.v2.metadata.SPSSODescriptorType;
+import org.jboss.identity.federation.saml.v2.metadata.SSODescriptorType;
+
+/**
+ * SAML2 Metadata Builder API
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Apr 19, 2009
+ */
+public class MetaDataBuilderDelegate
+{
+ private static ObjectFactory oFact = new ObjectFactory();
+
+ private static String pkgName = "org.jboss.identity.federation.saml.v2.metadata";
+ /**
+ * Create an Endpoint (SingleSignOnEndpoint or SingleLogoutEndpoint)
+ * @param binding
+ * @param location
+ * @param responseLocation
+ * @return
+ */
+ public static EndpointType createEndpoint(String binding, String location,
+ String responseLocation)
+ {
+ EndpointType endpoint = oFact.createEndpointType();
+ endpoint.setBinding(binding);
+ endpoint.setLocation(location);
+ endpoint.setResponseLocation(responseLocation);
+ return endpoint;
+ }
+
+ /**
+ * Create an Organization
+ * @param organizationName
+ * @param organizationDisplayName
+ * @param organizationURL
+ * @param lang
+ * @return
+ */
+ public static OrganizationType createOrganization(String organizationName,
+ String organizationDisplayName, String organizationURL, String lang)
+ {
+ if(organizationName == null)
+ throw new IllegalArgumentException("organizationName is null");
+ if(organizationDisplayName == null)
+ throw new IllegalArgumentException("organizationDisplayName is null");
+ if(organizationURL == null)
+ throw new IllegalArgumentException("organizationURL is null");
+ if(lang == null)
+ lang = JBossSAMLConstants.LANG_EN.get();
+
+ //orgName
+ LocalizedNameType orgName = oFact.createLocalizedNameType();
+ orgName.setValue(organizationName);
+ orgName.setLang(lang);
+
+ //orgDisplayName
+ LocalizedNameType orgDisplayName = oFact.createLocalizedNameType();
+ orgDisplayName.setValue(organizationDisplayName);
+ orgDisplayName.setLang(lang);
+
+ //orgURL
+ LocalizedURIType orgURL = oFact.createLocalizedURIType();
+ orgURL.setValue(organizationURL);
+ orgURL.setLang(lang);
+
+ OrganizationType orgType = oFact.createOrganizationType();
+ orgType.getOrganizationName().add(orgName);
+ orgType.getOrganizationDisplayName().add(orgDisplayName);
+ orgType.getOrganizationURL().add(orgURL);
+ return orgType;
+ }
+
+ /**
+ * Create an Entity Descriptor
+ * @param idpOrSPDescriptor a descriptor for either the IDP or SSO
+ * @return
+ */
+ public static EntityDescriptorType createEntityDescriptor(SSODescriptorType idpOrSPDescriptor)
+ {
+ EntityDescriptorType entity = oFact.createEntityDescriptorType();
+ entity.getRoleDescriptorOrIDPSSODescriptorOrSPSSODescriptor().add(idpOrSPDescriptor);
+ return entity;
+ }
+
+ /**
+ * Create a IDP SSO metadata descriptor
+ * @param requestsSigned
+ * @param keyDescriptorType
+ * @param ssoEndPoint
+ * @param sloEndPoint
+ * @param attributes
+ * @param org
+ * @return
+ */
+ public static IDPSSODescriptorType createIDPSSODescriptor(boolean requestsSigned,
+ KeyDescriptorType keyDescriptorType,
+ EndpointType ssoEndPoint,
+ EndpointType sloEndPoint,
+ List<AttributeType> attributes,
+ OrganizationType org)
+ {
+ IDPSSODescriptorType idp = oFact.createIDPSSODescriptorType();
+ idp.getSingleSignOnService().add(ssoEndPoint);
+ idp.getSingleLogoutService().add(sloEndPoint);
+ idp.getAttribute().addAll(attributes);
+ idp.getKeyDescriptor().add(keyDescriptorType);
+ idp.setWantAuthnRequestsSigned(requestsSigned);
+ idp.setOrganization(org);
+ return idp;
+ }
+
+ /**
+ * Create a IDP SSO metadata descriptor
+ * @param requestsSigned
+ * @param keyDescriptorType
+ * @param ssoEndPoint
+ * @param sloEndPoint
+ * @param attributes
+ * @param org
+ * @return
+ */
+ public static SPSSODescriptorType createSPSSODescriptor(boolean requestsSigned,
+ KeyDescriptorType keyDescriptorType,
+ EndpointType sloEndPoint,
+ List<AttributeType> attributes,
+ OrganizationType org)
+ {
+ SPSSODescriptorType sp = oFact.createSPSSODescriptorType();
+ sp.getSingleLogoutService().add(sloEndPoint);
+ sp.getKeyDescriptor().add(keyDescriptorType);
+ sp.setAuthnRequestsSigned(requestsSigned);
+ sp.setOrganization(org);
+ return sp;
+ }
+
+ /**
+ * Get the marshaller
+ * @return
+ * @throws JAXBException
+ */
+ public static Marshaller getMarshaller() throws JAXBException
+ {
+ return JAXBUtil.getMarshaller(pkgName);
+ }
+
+ /**
+ * Get the Unmarshaller
+ * @return
+ * @throws JAXBException
+ */
+ public static Unmarshaller getUnmarshaller() throws JAXBException
+ {
+ return JAXBUtil.getUnmarshaller(pkgName);
+ }
+
+ /**
+ * Get the ObjectFactory for method chaining
+ * @return
+ */
+ public static ObjectFactory getObjectFactory()
+ {
+ return oFact;
+ }
+}
\ No newline at end of file
Added: identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/md/providers/SecurityActions.java
===================================================================
--- identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/md/providers/SecurityActions.java (rev 0)
+++ identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/md/providers/SecurityActions.java 2009-11-06 17:28:15 UTC (rev 908)
@@ -0,0 +1,57 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.identity.federation.core.saml.md.providers;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+/**
+ * Privileged Blocks
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Mar 17, 2009
+ */
+class SecurityActions
+{
+ static void setSystemProperty( final String key, final String value)
+ {
+ AccessController.doPrivileged(new PrivilegedAction<Object>()
+ {
+ public Object run()
+ {
+ System.setProperty(key, value);
+ return null;
+ }
+ });
+ }
+
+ static ClassLoader getContextClassLoader()
+ {
+ return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>()
+ {
+ public ClassLoader run()
+ {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ });
+ }
+
+}
\ No newline at end of file
Added: identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/servlets/saml/MetadataServlet.java
===================================================================
--- identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/servlets/saml/MetadataServlet.java (rev 0)
+++ identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/servlets/saml/MetadataServlet.java 2009-11-06 17:28:15 UTC (rev 908)
@@ -0,0 +1,202 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.identity.federation.web.servlets.saml;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.security.cert.Certificate;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.bind.JAXBElement;
+
+import org.apache.log4j.Logger;
+import org.jboss.identity.federation.api.saml.v2.metadata.KeyDescriptorMetaDataBuilder;
+import org.jboss.identity.federation.api.saml.v2.metadata.MetaDataBuilder;
+import org.jboss.identity.federation.api.util.KeyUtil;
+import org.jboss.identity.federation.core.config.KeyProviderType;
+import org.jboss.identity.federation.core.config.KeyValueType;
+import org.jboss.identity.federation.core.config.MetadataProviderType;
+import org.jboss.identity.federation.core.config.ProviderType;
+import org.jboss.identity.federation.core.interfaces.IMetadataProvider;
+import org.jboss.identity.federation.core.interfaces.TrustKeyManager;
+import org.jboss.identity.federation.core.saml.v2.constants.JBossSAMLConstants;
+import org.jboss.identity.federation.core.util.XMLEncryptionUtil;
+import org.jboss.identity.federation.saml.v2.metadata.EntityDescriptorType;
+import org.jboss.identity.federation.saml.v2.metadata.KeyDescriptorType;
+import org.jboss.identity.federation.saml.v2.metadata.RoleDescriptorType;
+import org.jboss.identity.federation.web.constants.GeneralConstants;
+import org.jboss.identity.federation.web.util.ConfigurationUtil;
+import org.jboss.identity.xmlsec.w3.xmldsig.KeyInfoType;
+
+
+import static org.jboss.identity.federation.core.util.StringUtil.isNotNull;
+
+/**
+ * Metadata servlet for the IDP/SP
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Apr 22, 2009
+ */
+public class MetadataServlet extends HttpServlet
+{
+ private static final long serialVersionUID = 1L;
+ private static Logger log = Logger.getLogger(MetadataServlet.class);
+ private boolean trace = log.isTraceEnabled();
+
+ private String configFileLocation = GeneralConstants.CONFIG_FILE_LOCATION;
+ private transient MetadataProviderType metadataProviderType = null;
+
+ private transient IMetadataProvider<?> metadataProvider = null;
+
+ private transient EntityDescriptorType metadata;
+
+ private String signingAlias = null;
+ private String encryptingAlias = null;
+ private TrustKeyManager keyManager;
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public void init(ServletConfig config) throws ServletException
+ {
+ super.init(config);
+ try
+ {
+ ServletContext context = config.getServletContext();
+ String configL = config.getInitParameter("configFile");
+ if(isNotNull(configL))
+ configFileLocation = configL;
+ if(trace)
+ log.trace("Config File Location="+ configFileLocation);
+ InputStream is = context.getResourceAsStream(configFileLocation);
+ if(is == null)
+ throw new RuntimeException(configFileLocation + " missing");
+
+ //Look for signing alias
+ signingAlias = config.getInitParameter("signingAlias");
+ encryptingAlias = config.getInitParameter("encryptingAlias");
+
+ ProviderType providerType = ConfigurationUtil.getIDPConfiguration(is);
+ metadataProviderType = providerType.getMetaDataProvider();
+ String fqn = metadataProviderType.getClassName();
+ ClassLoader tcl = SecurityActions.getContextClassLoader();
+ Class<?> clazz = tcl.loadClass(fqn);
+ metadataProvider = (IMetadataProvider) clazz.newInstance();
+ List<KeyValueType> keyValues = metadataProviderType.getOption();
+ Map<String,String> options = new HashMap<String,String>();
+ if(keyValues != null)
+ {
+ for(KeyValueType kvt: keyValues)
+ options.put(kvt.getKey(), kvt.getValue());
+ }
+ metadataProvider.init(options);
+ if(metadataProvider.isMultiple())
+ throw new RuntimeException("Multiple Entities not currently supported");
+
+ /**
+ * Since a metadata provider does not have access to the servlet context.
+ * It may be difficult to get to the resource from the TCL.
+ */
+ String fileInjectionStr = metadataProvider.requireFileInjection();
+ if(isNotNull(fileInjectionStr))
+ {
+ metadataProvider.injectFileStream(context.getResourceAsStream(fileInjectionStr));
+ }
+
+ metadata = (EntityDescriptorType) metadataProvider.getMetaData();
+
+ //Get the trust manager information
+ KeyProviderType keyProvider = providerType.getKeyProvider();
+ signingAlias = keyProvider.getSigningAlias();
+ String keyManagerClassName = keyProvider.getClassName();
+ if(keyManagerClassName == null)
+ throw new RuntimeException("KeyManager class name is null");
+
+ clazz = tcl.loadClass(keyManagerClassName);
+ this.keyManager = (TrustKeyManager) clazz.newInstance();
+ keyManager.setAuthProperties(keyProvider.getAuth());
+
+ Certificate cert = keyManager.getCertificate(signingAlias);
+ KeyInfoType keyInfo = KeyUtil.getKeyInfo(cert);
+
+ //TODO: Assume just signing key for now
+ KeyDescriptorType keyDescriptor = KeyDescriptorMetaDataBuilder.createKeyDescriptor(keyInfo,
+ null, 0, true, false);
+
+ updateKeyDescriptor(metadata, keyDescriptor);
+
+ //encryption
+ if(this.encryptingAlias != null)
+ {
+ cert = keyManager.getCertificate(encryptingAlias);
+ keyInfo = KeyUtil.getKeyInfo(cert);
+ String certAlgo = cert.getPublicKey().getAlgorithm();
+ keyDescriptor = KeyDescriptorMetaDataBuilder.createKeyDescriptor(keyInfo,
+ XMLEncryptionUtil.getEncryptionURL(certAlgo),
+ XMLEncryptionUtil.getEncryptionKeySize(certAlgo), false, true);
+ updateKeyDescriptor(metadata, keyDescriptor);
+ }
+ } catch(Exception e)
+ {
+ log.error("Exception in starting servlet:",e);
+ throw new ServletException("Unable to start servlet");
+ }
+
+ }
+
+
+ @Override
+ protected void doGet(HttpServletRequest req, HttpServletResponse resp)
+ throws ServletException, IOException
+ {
+ resp.setContentType(JBossSAMLConstants.METADATA_MIME.get());
+ OutputStream os = resp.getOutputStream();
+ JAXBElement<?> jaxbEl = MetaDataBuilder.getObjectFactory().createEntityDescriptor(metadata);
+ try
+ {
+ MetaDataBuilder.getMarshaller().marshal(jaxbEl , os);
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private void updateKeyDescriptor(EntityDescriptorType entityD, KeyDescriptorType keyD)
+ {
+ List<RoleDescriptorType> objs = entityD.getRoleDescriptorOrIDPSSODescriptorOrSPSSODescriptor();
+ if(objs != null)
+ {
+ for(RoleDescriptorType roleD: objs)
+ {
+ roleD.getKeyDescriptor().add(keyD);
+ }
+ }
+ }
+}
\ No newline at end of file
Added: identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/servlets/saml/SOAPSAMLXACMLServlet.java
===================================================================
--- identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/servlets/saml/SOAPSAMLXACMLServlet.java (rev 0)
+++ identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/servlets/saml/SOAPSAMLXACMLServlet.java 2009-11-06 17:28:15 UTC (rev 908)
@@ -0,0 +1,287 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.identity.federation.web.servlets.saml;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.security.PrivilegedActionException;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.bind.helpers.DefaultValidationEventHandler;
+
+import org.apache.log4j.Logger;
+import org.jboss.identity.federation.api.saml.v2.response.SAML2Response;
+import org.jboss.identity.federation.core.factories.SOAPFactory;
+import org.jboss.identity.federation.core.factories.XACMLContextFactory;
+import org.jboss.identity.federation.core.saml.v2.common.IDGenerator;
+import org.jboss.identity.federation.core.saml.v2.factories.SAMLAssertionFactory;
+import org.jboss.identity.federation.core.saml.v2.holders.IssuerInfoHolder;
+import org.jboss.identity.federation.core.saml.v2.util.DocumentUtil;
+import org.jboss.identity.federation.core.saml.v2.util.JAXBElementMappingUtil;
+import org.jboss.identity.federation.core.saml.v2.util.SOAPSAMLXACMLUtil;
+import org.jboss.identity.federation.core.saml.v2.util.XMLTimeUtil;
+import org.jboss.identity.federation.core.util.JAXBUtil;
+import org.jboss.identity.federation.org.xmlsoap.schemas.soap.envelope.Body;
+import org.jboss.identity.federation.org.xmlsoap.schemas.soap.envelope.Envelope;
+import org.jboss.identity.federation.org.xmlsoap.schemas.soap.envelope.Fault;
+import org.jboss.identity.federation.saml.v2.assertion.AssertionType;
+import org.jboss.identity.federation.saml.v2.assertion.StatementAbstractType;
+import org.jboss.identity.federation.saml.v2.profiles.xacml.assertion.XACMLAuthzDecisionStatementType;
+import org.jboss.identity.federation.saml.v2.profiles.xacml.protocol.XACMLAuthzDecisionQueryType;
+import org.jboss.identity.federation.saml.v2.protocol.RequestAbstractType;
+import org.jboss.security.xacml.core.JBossPDP;
+import org.jboss.security.xacml.core.JBossRequestContext;
+import org.jboss.security.xacml.core.model.context.RequestType;
+import org.jboss.security.xacml.core.model.context.ResponseType;
+import org.jboss.security.xacml.core.model.context.ResultType;
+import org.jboss.security.xacml.interfaces.PolicyDecisionPoint;
+import org.jboss.security.xacml.interfaces.RequestContext;
+import org.jboss.security.xacml.interfaces.ResponseContext;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/**
+ * Servlet that can read SOAP 1.1 messages that contain
+ * an XACML query in saml payload
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Jan 27, 2009
+ */
+public class SOAPSAMLXACMLServlet extends HttpServlet
+{
+ private static Logger log = Logger.getLogger(SOAPSAMLXACMLServlet.class);
+ private boolean trace = log.isTraceEnabled();
+
+ private static final long serialVersionUID = 1L;
+
+ private String policyConfigFileName = null;
+
+ private String issuerId = null;
+ private String issuer = null;
+
+ boolean debug = false;
+
+ private transient PolicyDecisionPoint pdp = null;
+
+ public void init(ServletConfig config) throws ServletException
+ {
+ issuerId = config.getInitParameter("issuerID");
+ if(issuerId == null)
+ issuerId = "issue-id:1";
+
+ issuer = config.getInitParameter("issuer");
+ if(issuer == null)
+ issuer = "urn:jboss-identity";
+
+ policyConfigFileName = config.getInitParameter("policyConfigFileName");
+ if(policyConfigFileName == null)
+ policyConfigFileName = "policyConfig.xml";
+
+ String debugStr = config.getInitParameter("debug");
+ try
+ {
+ debug = Boolean.parseBoolean(debugStr);
+ }
+ catch(Exception ignore)
+ {
+ debug = false;
+ }
+
+ if(trace)
+ {
+ log.trace("Issuer=" + issuer + " :: issuerID=" + issuerId);
+ log.trace("PolicyConfig File:" + policyConfigFileName);
+ log.trace("Debug="+debug);
+ }
+
+ if(debug)
+ {
+ SecurityActions.setSystemProperty("jaxb.debug", "true");
+ }
+
+ try
+ {
+ pdp = this.getPDP();
+ }
+ catch (PrivilegedActionException e)
+ {
+ log("Exception loading PDP::",e);
+ throw new ServletException("Unable to load PDP");
+ }
+ super.init(config);
+ }
+
+
+ @SuppressWarnings("unchecked")
+ @Override
+ protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
+ {
+ JAXBElement<RequestAbstractType> jaxbRequestType = null;
+
+ Envelope envelope = null;
+ XACMLAuthzDecisionQueryType xacmlRequest = null;
+
+ try
+ {
+ Document inputDoc = DocumentUtil.getDocument(req.getInputStream());
+ if(debug && trace)
+ log.trace("Received SOAP:"+DocumentUtil.getDocumentAsString(inputDoc));
+
+ Unmarshaller un = JAXBUtil.getUnmarshaller(SOAPSAMLXACMLUtil.getPackage());
+ if(debug)
+ un.setEventHandler(new DefaultValidationEventHandler());
+
+ Object unmarshalledObject = un.unmarshal(DocumentUtil.getNodeAsStream(inputDoc));
+
+ if(unmarshalledObject instanceof JAXBElement)
+ {
+ JAXBElement<?> jaxbElement = (JAXBElement<?>) unmarshalledObject;
+ Object element = jaxbElement.getValue();
+ if(element instanceof Envelope)
+ {
+ envelope = (Envelope)element;
+ Body soapBody = envelope.getBody();
+ Object samlRequest = soapBody.getAny().get(0);
+ if(samlRequest instanceof JAXBElement)
+ {
+ jaxbRequestType = (JAXBElement<RequestAbstractType>)samlRequest;
+ jaxbRequestType = (JAXBElement<RequestAbstractType>)samlRequest;
+ xacmlRequest = (XACMLAuthzDecisionQueryType) jaxbRequestType.getValue();
+ }
+ else
+ if(samlRequest instanceof Element)
+ {
+ Element elem = (Element) samlRequest;
+ xacmlRequest = SOAPSAMLXACMLUtil.getXACMLQueryType(elem);
+ }
+ }
+ else if(element instanceof XACMLAuthzDecisionQueryType)
+ {
+ xacmlRequest = (XACMLAuthzDecisionQueryType) element;
+ }
+ }
+ if(xacmlRequest == null)
+ throw new IOException("XACML Request not parsed");
+
+ RequestType requestType = xacmlRequest.getRequest();
+
+ RequestContext requestContext = new JBossRequestContext();
+ requestContext.setRequest(requestType);
+
+ //pdp evaluation is thread safe
+ ResponseContext responseContext = pdp.evaluate(requestContext);
+
+ ResponseType responseType = new ResponseType();
+ ResultType resultType = responseContext.getResult();
+ responseType.getResult().add(resultType);
+
+ XACMLAuthzDecisionStatementType xacmlStatement =
+ XACMLContextFactory.createXACMLAuthzDecisionStatementType(requestType, responseType);
+
+ //Place the xacml statement in an assertion
+ //Then the assertion goes inside a SAML Response
+
+ String ID = IDGenerator.create("ID_");
+ SAML2Response saml2Response = new SAML2Response();
+ IssuerInfoHolder issuerInfo = new IssuerInfoHolder(this.issuer);
+
+ List<StatementAbstractType> statements = new ArrayList<StatementAbstractType>();
+ statements.add(xacmlStatement);
+
+ AssertionType assertion = SAMLAssertionFactory.createAssertion(ID,
+ issuerInfo.getIssuer(),
+ XMLTimeUtil.getIssueInstant(),
+ null,
+ null,
+ statements);
+
+ JAXBElement<?> jaxbResponse = JAXBElementMappingUtil.get(saml2Response.createResponseType(ID, issuerInfo, assertion));
+
+ //Create a SOAP Envelope to hold the SAML response
+ envelope = this.createEnvelope(jaxbResponse);
+ }
+ catch (JAXBException e)
+ {
+ String id = IDGenerator.create();
+ log.error(id + "::Exception parsing SOAP:", e);
+ envelope = this.createEnvelope(this.createFault("Parsing Error. Reference::" + id));
+ }
+ catch (Exception e)
+ {
+ String id = IDGenerator.create();
+ log.error(id + "::Exception:", e);
+ envelope = this.createEnvelope(this.createFault("Server Error. Reference::" + id));
+ }
+ finally
+ {
+ resp.setContentType("text/xml;charset=utf-8");;
+ OutputStream os = resp.getOutputStream();
+ try
+ {
+ if(envelope == null)
+ throw new IllegalStateException("SOAPEnvelope is null");
+ JAXBElement<?> jaxbEnvelope = JAXBElementMappingUtil.get(envelope);
+ Marshaller marshaller = JAXBUtil.getMarshaller(SOAPSAMLXACMLUtil.getPackage());
+ marshaller.marshal(jaxbEnvelope, os);
+ }
+ catch (JAXBException e)
+ {
+ log("marshalling exception",e);
+ }
+ }
+ }
+
+ private PolicyDecisionPoint getPDP() throws PrivilegedActionException
+ {
+ ClassLoader tcl = SecurityActions.getContextClassLoader();
+ InputStream is = tcl.getResourceAsStream(this.policyConfigFileName);
+ if(is == null)
+ throw new IllegalStateException(policyConfigFileName + " could not be located");
+ return new JBossPDP(is);
+ }
+
+ private Envelope createEnvelope(Object obj)
+ {
+ Envelope envelope = SOAPFactory.getObjectFactory().createEnvelope();
+ Body body = SOAPFactory.getObjectFactory().createBody();
+ body.getAny().add(obj);
+ envelope.setBody(body);
+ return envelope;
+ }
+
+ private JAXBElement<Fault> createFault(String msg)
+ {
+ Fault fault = SOAPFactory.getObjectFactory().createFault();
+ fault.setFaultstring(msg);
+ return SOAPFactory.getObjectFactory().createFault(fault);
+ }
+}
\ No newline at end of file
Added: identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/servlets/saml/SecurityActions.java
===================================================================
--- identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/servlets/saml/SecurityActions.java (rev 0)
+++ identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/servlets/saml/SecurityActions.java 2009-11-06 17:28:15 UTC (rev 908)
@@ -0,0 +1,57 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.identity.federation.web.servlets.saml;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+/**
+ * Privileged Blocks
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Mar 17, 2009
+ */
+class SecurityActions
+{
+ static void setSystemProperty( final String key, final String value)
+ {
+ AccessController.doPrivileged(new PrivilegedAction<Object>()
+ {
+ public Object run()
+ {
+ System.setProperty(key, value);
+ return null;
+ }
+ });
+ }
+
+ static ClassLoader getContextClassLoader()
+ {
+ return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>()
+ {
+ public ClassLoader run()
+ {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ });
+ }
+
+}
\ No newline at end of file
Modified: identity-federation/trunk/jboss-identity-webapps/metadata/resources/WEB-INF/web.xml
===================================================================
--- identity-federation/trunk/jboss-identity-webapps/metadata/resources/WEB-INF/web.xml 2009-11-05 19:23:37 UTC (rev 907)
+++ identity-federation/trunk/jboss-identity-webapps/metadata/resources/WEB-INF/web.xml 2009-11-06 17:28:15 UTC (rev 908)
@@ -11,7 +11,7 @@
<servlet>
<servlet-name>metadata</servlet-name>
- <servlet-class>org.jboss.identity.federation.bindings.servlets.MetadataServlet</servlet-class>
+ <servlet-class>org.jboss.identity.federation.web.servlets.saml.MetadataServlet</servlet-class>
</servlet>
<servlet-mapping>
16 years, 6 months
JBoss Identity SVN: r907 - in idm/trunk: idm-cache/src/main/java/org/jboss/identity/idm/impl/cache and 12 other directories.
by jboss-identity-commits@lists.jboss.org
Author: bdaw
Date: 2009-11-05 14:23:37 -0500 (Thu, 05 Nov 2009)
New Revision: 907
Added:
idm/trunk/idm-cache/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheIdentityStoreCacheProviderImpl.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/AbstractSPISearchImpl.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/IdentityObjectRelationshipNameSearchImpl.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/IdentityObjectRelationshipSearchImpl.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/IdentityObjectSearchImpl.java
idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/cache/IdentityObjectRelationshipNameSearch.java
idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/cache/IdentityObjectRelationshipSearch.java
idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/cache/IdentityObjectSearch.java
idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/cache/Search.java
Removed:
idm/trunk/idm-cache/src/main/java/org/jboss/identity/idm/impl/cache/IdentityStoreCacheProviderImpl.java
Modified:
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/cache/APICacheProvider.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/cache/Search.java
idm/trunk/idm-cache/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheAPICacheProviderImpl.java
idm/trunk/idm-cache/src/test/java/org/jboss/identity/idm/cache/APICacheProviderTestCase.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/IdentitySearchCriteriaImpl.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/IdentitySessionFactoryImpl.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/IdentitySessionImpl.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheAttributeStoreWrapper.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheIdentityStoreWrapper.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/configuration/IdentityConfigurationImpl.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/configuration/IdentitySessionConfigurationContext.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/repository/AbstractIdentityStoreRepository.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/repository/FallbackIdentityStoreRepository.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/repository/WrapperIdentityStoreRepository.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/store/SimpleIdentityStoreInvocationContext.java
idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/cache/IdentityStoreCacheProvider.java
idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/store/IdentityStoreInvocationContext.java
idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreTestCase.java
idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/store/ldap/LDAPIdentityStoreTestCase.java
idm/trunk/idm-testsuite/src/test/resources/test-identity-config-msad-local.xml
idm/trunk/idm-testsuite/src/test/resources/test-identity-config-msad.xml
idm/trunk/idm-testsuite/src/test/resources/test-identity-config-openldapds.xml
idm/trunk/idm-testsuite/src/test/resources/test-identity-config-redhatds.xml
idm/trunk/idm-testsuite/src/test/resources/test-identity-config-sunds.xml
idm/trunk/idm-testsuite/src/test/resources/test-identity-config.xml
Log:
- SPI caching layer improvements
Modified: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/cache/APICacheProvider.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/cache/APICacheProvider.java 2009-11-05 12:19:23 UTC (rev 906)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/cache/APICacheProvider.java 2009-11-05 19:23:37 UTC (rev 907)
@@ -22,6 +22,7 @@
package org.jboss.identity.idm.cache;
import org.jboss.identity.idm.api.*;
+import org.jboss.identity.idm.api.cfg.IdentityConfigurationRegistry;
import org.jboss.identity.idm.api.query.GroupQuery;
import org.jboss.identity.idm.api.query.RoleQuery;
import org.jboss.identity.idm.api.query.UserQuery;
@@ -44,7 +45,7 @@
* Initialize provider.
* @param properties
*/
- void initialize(Map<String, String> properties);
+ void initialize(Map<String, String> properties, IdentityConfigurationRegistry configurationRegistry);
void invalidate(String ns);
Modified: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/cache/Search.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/cache/Search.java 2009-11-05 12:19:23 UTC (rev 906)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/cache/Search.java 2009-11-05 19:23:37 UTC (rev 907)
@@ -27,7 +27,7 @@
import java.io.Serializable;
-public interface Search extends Serializable
+public abstract interface Search extends Serializable
{
IdentitySearchCriteria getSearchCriteria();
Deleted: idm/trunk/idm-cache/src/main/java/org/jboss/identity/idm/impl/cache/IdentityStoreCacheProviderImpl.java
===================================================================
--- idm/trunk/idm-cache/src/main/java/org/jboss/identity/idm/impl/cache/IdentityStoreCacheProviderImpl.java 2009-11-05 12:19:23 UTC (rev 906)
+++ idm/trunk/idm-cache/src/main/java/org/jboss/identity/idm/impl/cache/IdentityStoreCacheProviderImpl.java 2009-11-05 19:23:37 UTC (rev 907)
@@ -1,933 +0,0 @@
-/*
-* JBoss, a division of Red Hat
-* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-
-package org.jboss.identity.idm.impl.cache;
-
-import org.jboss.cache.Fqn;
-import org.jboss.cache.Cache;
-import org.jboss.cache.CacheFactory;
-import org.jboss.cache.DefaultCacheFactory;
-import org.jboss.cache.Node;
-import org.jboss.identity.idm.spi.model.IdentityObject;
-import org.jboss.identity.idm.spi.model.IdentityObjectType;
-import org.jboss.identity.idm.spi.model.IdentityObjectRelationshipType;
-import org.jboss.identity.idm.spi.model.IdentityObjectAttribute;
-import org.jboss.identity.idm.spi.model.IdentityObjectRelationship;
-import org.jboss.identity.idm.spi.search.IdentityObjectSearchCriteria;
-import org.jboss.identity.idm.spi.cache.IdentityStoreCacheProvider;
-
-import java.util.logging.Logger;
-import java.util.logging.Level;
-import java.util.Set;
-import java.util.Map;
-import java.util.Collection;
-import java.io.InputStream;
-
-/**
- * Helper class providing caching support for IdentityStore. Stores search methods results using hash from a set of used
- * IdentityObjectSearchControl objects as a key. *
- *
- * TODO: update cache tree structure documentation to all used nodes/keys...
- * Cache structure:
- *
- * CACHE_ROOT (real)
- * |
- * |-JBID_ROOT_NODE
- * |
- * |-OBJECT_TYPES_NODE
- * | |
- * | |-OBJECT_TYPES_IDS_NODE
- * | | |
- * | | |- (IdentityObjectType names)
- * | | | key[NODE_OBJECT_KEY] -> IdentityObject
- * | | |- ...
- * | |
- * | |-OBJECT_TYPES_NAMES_NODE
- * | | |
- * | | |- (IdentityObjectType names)
- * | | | key[NODE_OBJECT_KEY] -> IdentityObject
- * | | | key[NODE_ATTRIBUTES_KEY] -> Map<String, IdentityObjectAttribute>
- * | | |- ...
- * | |
- * | |-OBJECT_TYPES_SEARCH_NODE
- * | |
- * | |
- * | |- ...
- * |
- * |-RELATIONSHIPS_NODE
- * |
-
- *
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
- * @version : 0.1 $
- */
-public class IdentityStoreCacheProviderImpl implements IdentityStoreCacheProvider
-{
- private static Logger log = Logger.getLogger(IdentityStoreCacheProvider.class.getName());
-
- //Structure
- public static final String JBID_ROOT_NODE = "/jboss_id_idm";
-
- public static final String OBJECT_TYPES_NODE = JBID_ROOT_NODE + "/object_types";
-
- public static final String OBJECT_TYPES_IDS_NODE = OBJECT_TYPES_NODE + "/by_ids";
-
- public static final String OBJECT_TYPES_NAMES_NODE = OBJECT_TYPES_NODE + "/by_names";
-
- public static final String OBJECT_TYPES_SEARCH_BY_TYPE_NODE = OBJECT_TYPES_NODE + "/search_by_type";
-
- public static final String OBJECT_TYPES_SEARCH_NODE = OBJECT_TYPES_NODE + "/search";
-
- // Don't populate children as resident nodes!
- public static final String OBJECT_TYPES_COUNT_NODE = OBJECT_TYPES_NODE + "/count";
-
- public static final String RELATIONSHIPS_SEARCH_NODE = JBID_ROOT_NODE + "/relationship_types_names";
-
- public static final String RELATIONSHIPS_SEARCH_SIMPLE_NODE = RELATIONSHIPS_SEARCH_NODE + "/simple";
-
- public static final String RELATIONSHIPS_SEARCH_COMPLEX_NODE = RELATIONSHIPS_SEARCH_NODE + "/complex";
-
- public static final String RELATIONSHIP_NAMES_SEARCH_NODE = JBID_ROOT_NODE + "/relationship_names_search";
-
- public static final String RELATIONSHIP_NAMES_SEARCH_IO_NODE = RELATIONSHIP_NAMES_SEARCH_NODE + "/identity_object";
-
- public static final String RELATIONSHIP_NAMES_SEARCH_ALL_NODE = RELATIONSHIP_NAMES_SEARCH_NODE + "/all";
-
- // Node keys
-
- public static final String NODE_OBJECT_KEY = "object";
-
- public static final String NODE_ATTRIBUTES_KEY = "attributes";
-
- public static final String NODE_REL_NAME_KEY = "relationship_name";
-
- public static final String NODE_REL_TYPE_KEY = "relationship_type";
-
- public static final String NODE_REL_FROM_KEY = "relationship_from";
-
- public static final String NODE_REL_TO_KEY = "relationship_to";
-
- public static final String NODE_SEARCH_RESULTS_KEY = "search_results";
-
-
- // FQNs
-
- public static final Fqn FQN_OBJECT_TYPES = Fqn.fromString(OBJECT_TYPES_NODE);
-
- public static final Fqn FQN_OBJECT_TYPES_NAMES = Fqn.fromString(OBJECT_TYPES_NAMES_NODE);
-
- public static final Fqn FQN_OBJECT_TYPES_IDS = Fqn.fromString(OBJECT_TYPES_IDS_NODE);
-
- public static final Fqn FQN_OBJECT_TYPES_SEARCH_BY_TYPE = Fqn.fromString(OBJECT_TYPES_SEARCH_BY_TYPE_NODE);
-
- public static final Fqn FQN_OBJECT_TYPES_SEARCH = Fqn.fromString(OBJECT_TYPES_SEARCH_NODE);
-
- public static final Fqn FQN_OBJECT_TYPES_COUNT = Fqn.fromString(OBJECT_TYPES_COUNT_NODE);
-
- public static final Fqn FQN_RELATIONSHIPS = Fqn.fromString(RELATIONSHIPS_SEARCH_NODE);
-
- public static final Fqn FQN_RELATIONSHIPS_COMPLEX = Fqn.fromString(RELATIONSHIPS_SEARCH_COMPLEX_NODE);
-
- public static final Fqn FQN_RELATIONSHIPS_SIMPLE = Fqn.fromString(RELATIONSHIPS_SEARCH_SIMPLE_NODE);
-
- protected final Cache cache;
-
- public IdentityStoreCacheProviderImpl(InputStream cacheConfigInputStream)
- {
- CacheFactory factory = new DefaultCacheFactory();
-
- this.cache = factory.createCache(cacheConfigInputStream);
-
- this.cache.start();
-
- }
-
- private Fqn createIONameNodeFQN(String ioTypeName, String ioName)
- {
- return Fqn.fromElements(OBJECT_TYPES_NAMES_NODE, ioTypeName, ioName);
- }
-
- private Fqn createIONameNodeFQN(IdentityObject io)
- {
- return Fqn.fromElements(OBJECT_TYPES_NAMES_NODE, io.getIdentityType().getName(), io.getName());
- }
-
- private Fqn createIOIdNodeFQN(IdentityObject io)
- {
- return Fqn.fromElements(OBJECT_TYPES_IDS_NODE, io.getIdentityType().getName(), io.getId());
- }
-
- private Fqn createIOTypeCountNodeFQN(IdentityObjectType iot)
- {
- return Fqn.fromElements(OBJECT_TYPES_COUNT_NODE, iot.getName());
- }
-
- private Fqn createIOTypeSearchNodeFQN(IdentityObjectType iot, Object searchId)
- {
- return Fqn.fromElements(OBJECT_TYPES_SEARCH_BY_TYPE_NODE, iot.getName(), searchId);
- }
-
- private Fqn createIOSearchNodeFQN(IdentityObject io, IdentityObjectRelationshipType relationshipType, boolean parent, Object searchId)
- {
- return Fqn.fromElements(OBJECT_TYPES_SEARCH_NODE, io.getIdentityType().getName(), relationshipType == null ? "null" : relationshipType.getName(),
- io.getName() + "_" + parent, searchId);
- }
-
- private Fqn createRelationshipNamesIdentityObjectSearchFqn(IdentityObject identityObject, Object searchId)
- {
- return Fqn.fromElements(RELATIONSHIP_NAMES_SEARCH_IO_NODE, identityObject.getIdentityType() + "_" + identityObject.getName(),
- searchId);
- }
-
- private Fqn createRelationshipNamesAllSearchFqn(Object searchId)
- {
- return Fqn.fromElements(RELATIONSHIP_NAMES_SEARCH_ALL_NODE, searchId);
- }
-
- private Fqn createRelationshipsSimpleSearchFqn(IdentityObject fromIdentity,
- IdentityObject toIdentity,
- IdentityObjectRelationshipType relationshipType)
- {
- //TODO: fixme - null relationshipType
- return Fqn.fromElements(RELATIONSHIPS_SEARCH_SIMPLE_NODE, fromIdentity.getIdentityType().getName() + "_" + toIdentity.getName(),
- toIdentity.getIdentityType().getName() + "_" + toIdentity.getName(), relationshipType == null ? "null" : relationshipType );
- }
-
- private Fqn createRelationshipsComplexSearchFqn(IdentityObject identity,
- IdentityObjectRelationshipType relationshipType,
- boolean parent,
- boolean named,
- String name)
- {
- return Fqn.fromElements(RELATIONSHIPS_SEARCH_COMPLEX_NODE, identity.getIdentityType().getName() + "_" + identity.getName(),
- parent, relationshipType, named + "_" + name);
- }
-
- public static boolean isSchemaFqn(Fqn fqn)
- {
- if (fqn.equals(JBID_ROOT_NODE) ||
- fqn.equals(OBJECT_TYPES_NODE) ||
- fqn.equals(OBJECT_TYPES_IDS_NODE) ||
- fqn.equals(OBJECT_TYPES_NAMES_NODE) ||
- fqn.equals(RELATIONSHIPS_SEARCH_NODE))
- {
- return true;
- }
- return false;
- }
-
- public static boolean isFqnObjectTypeChild(Fqn fqn)
- {
- return fqn.isChildOf(FQN_OBJECT_TYPES);
- }
-
- public static boolean isFqnObjectTypeIdsChild(Fqn fqn)
- {
- return fqn.isChildOf(FQN_OBJECT_TYPES_IDS);
- }
-
- public static boolean isFqnObjectTypeNamesChild(Fqn fqn)
- {
- return fqn.isChildOf(FQN_OBJECT_TYPES_NAMES);
- }
-
- public static boolean isFqnObjectTypeSearchChild(Fqn fqn)
- {
- return fqn.isChildOf(FQN_OBJECT_TYPES_SEARCH_BY_TYPE);
- }
-
- public static boolean isFqnRelationshipsChild(Fqn fqn)
- {
- return fqn.isChildOf(FQN_RELATIONSHIPS);
- }
-
-
- private void removeNodeChildren(String path)
- {
- Fqn fqn = Fqn.fromString(path);
- Node node = getCache().getRoot().getChild(fqn);
-
- if (node != null)
- {
- Set<Object> names = node.getChildrenNames();
- for (Object name : names)
- {
- node.removeChild(name);
- }
- }
- }
-
- protected Logger getLog()
- {
- return log;
- }
-
- protected Cache getCache()
- {
- return cache;
- }
-
- public void initResidentNodes(Set<String> supportedIdentityObjectTypes,
- Set<String> supportedRelationshipTypes)
- {
- getCache().getRoot().addChild(Fqn.fromString(IdentityStoreCacheProviderImpl.JBID_ROOT_NODE)).setResident(true);
- getCache().getRoot().addChild(Fqn.fromString(IdentityStoreCacheProviderImpl.OBJECT_TYPES_NODE)).setResident(true);
- getCache().getRoot().addChild(FQN_OBJECT_TYPES_IDS).setResident(true);
- getCache().getRoot().addChild(FQN_OBJECT_TYPES_NAMES).setResident(true);
- getCache().getRoot().addChild(FQN_OBJECT_TYPES_SEARCH).setResident(true);
- getCache().getRoot().addChild(FQN_OBJECT_TYPES_SEARCH_BY_TYPE).setResident(true);
- getCache().getRoot().addChild(FQN_OBJECT_TYPES_COUNT).setResident(true);
- getCache().getRoot().addChild(Fqn.fromString(RELATIONSHIP_NAMES_SEARCH_ALL_NODE)).setResident(true);
- getCache().getRoot().addChild(Fqn.fromString(RELATIONSHIP_NAMES_SEARCH_IO_NODE)).setResident(true);
- getCache().getRoot().addChild(Fqn.fromString(RELATIONSHIPS_SEARCH_COMPLEX_NODE)).setResident(true);
- getCache().getRoot().addChild(Fqn.fromString(RELATIONSHIPS_SEARCH_SIMPLE_NODE)).setResident(true);
-
- for (String objectTypeName : supportedIdentityObjectTypes)
- {
- Fqn nodeFqn = Fqn.fromRelativeElements(FQN_OBJECT_TYPES_NAMES, "/" + objectTypeName);
- getCache().getRoot().addChild(nodeFqn).setResident(true);
-
- nodeFqn = Fqn.fromRelativeElements(FQN_OBJECT_TYPES_IDS, "/" + objectTypeName);
- getCache().getRoot().addChild(nodeFqn).setResident(true);
- }
- }
-
- public void putIntoCache(IdentityObject io)
- {
- Fqn nodeFqn = createIONameNodeFQN(io);
-
- Node ioNode = getCache().getRoot().addChild(nodeFqn);
-
- // in case this node was already present in cache
- if (!ioNode.getKeys().contains(NODE_OBJECT_KEY))
- {
- ioNode.put(NODE_OBJECT_KEY, io);
- }
-
- nodeFqn = createIOIdNodeFQN(io);
-
- ioNode = getCache().getRoot().addChild(nodeFqn);
-
- // in case this node was already present in cache
- if (!ioNode.getKeys().contains(NODE_OBJECT_KEY))
- {
- ioNode.put(NODE_OBJECT_KEY, io);
- }
-
- if (getLog().isLoggable(Level.FINER))
- {
- getLog().finer(this.toString() + "IdentityObject stored in cache: " + io.getName() + "; " + io.getId());
- }
- }
-
- public void putIntoCache(IdentityObject io, Map<String, IdentityObjectAttribute> attributesMap)
- {
- Fqn nodeFqn = createIONameNodeFQN(io);
-
- Node ioNode = getCache().getRoot().addChild(nodeFqn);
-
- // in case this node was already present in cache
- if (!ioNode.getKeys().contains(NODE_OBJECT_KEY))
- {
- ioNode.put(NODE_OBJECT_KEY, io);
- }
-
- if (!ioNode.getKeys().contains(NODE_ATTRIBUTES_KEY))
- {
- ioNode.put(NODE_ATTRIBUTES_KEY, attributesMap);
- }
-
- nodeFqn = createIOIdNodeFQN(io);
-
- ioNode = getCache().getRoot().addChild(nodeFqn);
-
- // in case this node was already present in cache
- if (!ioNode.getKeys().contains(NODE_OBJECT_KEY))
- {
- ioNode.put(NODE_OBJECT_KEY, io);
- }
-
- if (getLog().isLoggable(Level.FINER))
- {
- getLog().finer(this.toString() + "IdentityObject stored in cache with attributes map: " + io.getName() + "; " + io.getId()
- + "; type=" + io.getIdentityType().getName() );
- }
- }
-
- public void removeFromCache(IdentityObject io)
- {
- Fqn nodeFqn = createIONameNodeFQN(io);
-
- getCache().getRoot().removeChild(nodeFqn);
-
- nodeFqn = createIOIdNodeFQN(io);
-
- getCache().getRoot().removeChild(nodeFqn);
-
- if (getLog().isLoggable(Level.FINER))
- {
- getLog().finer(this.toString() + "IdentityObject removed from cache: " + io.getName() + "; " + io.getId()
- + "; type=" + io.getIdentityType().getName() );
- }
- }
-
- public void removeAttributesFromCache(IdentityObject io)
- {
- Fqn nodeFqn = createIONameNodeFQN(io);
-
- Node ioNode = getCache().getRoot().addChild(nodeFqn);
-
- ioNode.remove(NODE_ATTRIBUTES_KEY);
-
- if (getLog().isLoggable(Level.FINER))
- {
- getLog().finer(this.toString() + "IdentityObject attributes removed from cache: name=" + io.getName() + "; id=" + io.getId()
- + "; type=" + io.getIdentityType().getName() );
- }
- }
-
- public IdentityObject getFromCache(String name, IdentityObjectType identityObjectType)
- {
- Fqn nodeFqn = Fqn.fromElements(OBJECT_TYPES_NODE, identityObjectType.getName(), name);
-
- Node ioNode = getCache().getRoot().getChild(nodeFqn);
-
- if (ioNode != null)
- {
- IdentityObject io = (IdentityObject)ioNode.get(NODE_OBJECT_KEY);
-
- if (getLog().isLoggable(Level.FINER))
- {
- getLog().finer(this.toString() + "IdentityObject found in cache: name=" + io.getName() + "; id=" + io.getId());
- }
-
- return io;
- }
-
- return null;
-
- }
-
- public Map<String, IdentityObjectAttribute> getAttributesFromCache(String name, IdentityObjectType identityObjectType)
- {
- Fqn nodeFqn = Fqn.fromElements(OBJECT_TYPES_NODE, identityObjectType.getName(), name);
-
- Node ioNode = getCache().getRoot().getChild(nodeFqn);
-
- if (ioNode != null)
- {
- Map<String, IdentityObjectAttribute> attrs = (Map<String, IdentityObjectAttribute>)ioNode.get(NODE_ATTRIBUTES_KEY);
-
- if (attrs != null)
- {
- if (getLog().isLoggable(Level.FINER))
- {
- getLog().finer(this.toString() + "IdentityObject attributes found in cache: name=" + name + "; type=" + identityObjectType.getName());
- }
- }
- return attrs;
- }
-
- return null;
-
- }
-
- public IdentityObject getFromCache(String id)
- {
- Node idsNode = getCache().getRoot().getChild(OBJECT_TYPES_IDS_NODE);
-
- for (Node typeNode : (Set<Node>)idsNode.getChildren())
- {
- for (Object name : typeNode.getChildrenNames())
- {
- if (name.toString().equals(id))
- {
- IdentityObject io = (IdentityObject)typeNode.getChild(name).get(NODE_OBJECT_KEY);
-
- if (getLog().isLoggable(Level.FINER))
- {
- getLog().finer(this.toString() + "IdentityObject found in cache: name" + io.getName() + "; type" + io.getIdentityType().getName());
- }
-
- return io;
- }
- }
- }
-
- return null;
-
- }
-
- public void putIdentityObjectSearchIntoCache(IdentityObjectType identityType,
- IdentityObjectSearchCriteria criteria,
- Collection<IdentityObject> results)
- {
- Fqn nodeFqn = createIOTypeSearchNodeFQN(identityType, getControlsHash(criteria));
-
- Node searchNode = getCache().getRoot().addChild(nodeFqn);
-
- searchNode.put(NODE_SEARCH_RESULTS_KEY, results);
-
- if (getLog().isLoggable(Level.FINER))
- {
- getLog().finer(this.toString() + "IdentityObject search results stored in cache: type" + identityType.getName());
- }
- }
-
- public Collection<IdentityObject> getIdentityObjectSearchFromCache(IdentityObjectType identityType,
- IdentityObjectSearchCriteria criteria)
- {
- Fqn nodeFqn = createIOTypeSearchNodeFQN(identityType, getControlsHash(criteria));
-
- Node searchNode = getCache().getRoot().getChild(nodeFqn);
-
- Collection<IdentityObject> results = null;
-
- if (searchNode != null)
- {
-
-
- results = (Collection<IdentityObject>)searchNode.get(NODE_SEARCH_RESULTS_KEY);
-
- if (results != null && getLog().isLoggable(Level.FINER))
- {
- getLog().finer(this.toString() + "IdentityObject search results found in cache: type" + identityType.getName());
- }
- }
-
- return results;
-
- }
-
- public void putIdentityObjectSearchToCache(IdentityObject identity,
- IdentityObjectRelationshipType relationshipType,
- boolean parent,
- IdentityObjectSearchCriteria criteria,
- Collection<IdentityObject> results)
- {
-
- Fqn nodeFqn = createIOSearchNodeFQN(identity, relationshipType, parent, getControlsHash(criteria));
-
- Node searchNode = getCache().getRoot().addChild(nodeFqn);
-
- searchNode.put(NODE_SEARCH_RESULTS_KEY, results);
-
- if (getLog().isLoggable(Level.FINER))
- {
- getLog().finer(this.toString() + "IdentityObject search results stored in cache: IdentityObject name= " + identity.getName()
- + "; IdentityObject type= " + identity.getIdentityType().getName() + "; IdentityObjectRelationshipType= " + relationshipType +
- "; parent= " + parent);
- }
-
- }
-
- public Collection<IdentityObject> getIdentityObjectSearchFromCache(IdentityObject identity,
- IdentityObjectRelationshipType relationshipType,
- boolean parent,
- IdentityObjectSearchCriteria criteria)
- {
-
- Fqn nodeFqn = createIOSearchNodeFQN(identity, relationshipType, parent, getControlsHash(criteria));
-
- Node searchNode = getCache().getRoot().getChild(nodeFqn);
-
- Collection<IdentityObject> results = null;
-
- if (searchNode != null)
- {
- results = (Collection<IdentityObject>)searchNode.get(NODE_SEARCH_RESULTS_KEY);
-
- if (results != null && getLog().isLoggable(Level.FINER))
- {
- getLog().finer(this.toString() + "IdentityObject search results found in cache: IdentityObject name= " + identity.getName()
- + "; IdentityObject type= " + identity.getIdentityType().getName() + "; IdentityObjectRelationshipType= " + relationshipType +
- "; parent= " + parent);
- }
- }
-
- return results;
-
- }
-
- public void putRelationshipsSearchIntoCache(IdentityObject fromIdentity,
- IdentityObject toIdentity,
- IdentityObjectRelationshipType relationshipType,
- Set<IdentityObjectRelationship> results)
- {
-
- Fqn fqn = createRelationshipsSimpleSearchFqn(fromIdentity, toIdentity, relationshipType);
- Node node = getCache().getRoot().addChild(fqn);
-
- node.put(NODE_SEARCH_RESULTS_KEY, results);
-
- if (getLog().isLoggable(Level.FINER))
- {
- getLog().finer(this.toString() + "IdentityObjectRelationship search stored in cache: fromIdentity" +
- fromIdentity.toString() + "; toIdentity=" + toIdentity.toString() +
- "; relationshipType=" + relationshipType.getName() ) ;
- }
-
- }
-
-
-
- public Set<IdentityObjectRelationship> getRelationshipsSearchFromCache(IdentityObject fromIdentity,
- IdentityObject toIdentity,
- IdentityObjectRelationshipType relationshipType)
- {
- Fqn fqn = createRelationshipsSimpleSearchFqn(fromIdentity, toIdentity, relationshipType);
- Node node = getCache().getRoot().getChild(fqn);
-
- if (node != null)
- {
- if (node.getKeys().contains(NODE_SEARCH_RESULTS_KEY) && getLog().isLoggable(Level.FINER))
- {
- getLog().finer(this.toString() + "IdentityObjectRelationship search found in cache: fromIdentity" +
- fromIdentity.toString() + "; toIdentity=" + toIdentity.toString() +
- "; relationshipType=" + relationshipType.getName() ) ;
- }
-
- return (Set<IdentityObjectRelationship>)node.get(NODE_SEARCH_RESULTS_KEY);
- }
- return null;
- }
-
- public void putRelationshipSearchIntoCache(IdentityObject identity,
- IdentityObjectRelationshipType relationshipType,
- boolean parent,
- boolean named,
- String name,
- Set<IdentityObjectRelationship> results)
- {
- Fqn fqn = createRelationshipsComplexSearchFqn(identity, relationshipType, parent, named, name);
- Node node = getCache().getRoot().addChild(fqn);
-
- node.put(NODE_SEARCH_RESULTS_KEY, results);
-
- if (getLog().isLoggable(Level.FINER))
- {
- getLog().finer(this.toString() + "IdentityObjectRelationship search stored in cache: " +
- "identity" + identity.toString() +
- "; relationshipType=" + relationshipType.getName() +
- "; parent=" + parent +
- "; named=" + named +
- "; name=" + name) ;
- }
-
- }
-
-
-
- public Set<IdentityObjectRelationship> getRelationshipsSearchFromCache(IdentityObject identity,
- IdentityObjectRelationshipType relationshipType,
- boolean parent,
- boolean named,
- String name)
- {
- Fqn fqn = createRelationshipsComplexSearchFqn(identity, relationshipType, parent, named, name);
- Node node = getCache().getRoot().getChild(fqn);
-
- Set<IdentityObjectRelationship> results = null;
-
- if (node != null)
- {
- results = (Set<IdentityObjectRelationship>)node.get(NODE_SEARCH_RESULTS_KEY);
-
- if (results != null && getLog().isLoggable(Level.FINER))
- {
- getLog().finer(this.toString() + "IdentityObjectRelationship search found in cache: " +
- "identity" + identity.toString() +
- "; relationshipType=" + relationshipType.getName() +
- "; parent=" + parent +
- "; named=" + named +
- "; name=" + name) ;
- }
- }
- return results;
-
- }
-
- public void invalidateCachedIdentityObjectSearches(IdentityObject io)
- {
-
- Fqn fqn = Fqn.fromElements(OBJECT_TYPES_SEARCH_BY_TYPE_NODE, io.getIdentityType().getName());
- getCache().getRoot().removeChild(fqn);
-
- // It can be in any result in the type searches
- removeNodeChildren(OBJECT_TYPES_SEARCH_NODE);
-
- if (getLog().isLoggable(Level.FINER))
- {
- getLog().finer(this.toString() + "IdentityObject searches invalidated in cache: identityObject=" + io.toString());
- }
- }
-
- public void putIdentityObjectCountIntoCache(IdentityObjectType identityType, int count)
- {
- Fqn fqn = createIOTypeCountNodeFQN(identityType);
- Node node = getCache().getRoot().addChild(fqn);
-
- node.put(NODE_OBJECT_KEY, count);
-
- if (getLog().isLoggable(Level.FINER))
- {
- getLog().finer(this.toString() + "IdentityObjectType count search strored in cache: " +
- "identityObjectType=" + identityType.getName() +
- "; count=" + count);
- }
-
- }
-
- public int getIdentityObjectCountFromCache(IdentityObjectType identityType)
- {
- Fqn fqn = createIOTypeCountNodeFQN(identityType);
- Node node = getCache().getRoot().getChild(fqn);
-
-
- if (node != null && node.getKeys().contains(NODE_OBJECT_KEY))
- {
- int count = (Integer)(node.get(NODE_OBJECT_KEY));
-
- if (getLog().isLoggable(Level.FINER))
- {
- getLog().finer(this.toString() + "IdentityObjectType count search result found in cache: " +
- "identityObjectType=" + identityType.getName() +
- "; count=" + count);
- }
-
- return count;
-
- }
- // -1 means nothing in cache
- return -1;
- }
-
-
- public void invalidateCachedIdentityObjectCount(IdentityObjectType identityType)
- {
- Fqn fqn = createIOTypeCountNodeFQN(identityType);
- Node node = getCache().getRoot().addChild(fqn);
-
- node.remove(NODE_OBJECT_KEY);
-
- if (getLog().isLoggable(Level.FINER))
- {
- getLog().finer(this.toString() + "IdentityObjectType count search result invalidated in cache: " +
- "identityObjectType=" + identityType.getName());
- }
- }
-
- public void invalidateCachedRelationshipSearches(IdentityObject fromIdentity,
- IdentityObject toIdentity,
- IdentityObjectRelationshipType relationshipType,
- String relationshipName)
- {
- String fromName = fromIdentity.getIdentityType().getName() + "_" + fromIdentity.getName();
- String toName = toIdentity.getIdentityType().getName() + "_" + toIdentity.getName();
-
- // Simple
-
-// Fqn fqn = Fqn.fromElements(RELATIONSHIPS_SEARCH_SIMPLE_NODE, fromName, toName, relationshipType.getName());
-// getCache().getRoot().removeChild(fqn);
-
- Fqn fqn = createRelationshipsSimpleSearchFqn(fromIdentity, toIdentity, relationshipType);
- getCache().getRoot().removeChild(fqn);
-
- // Complex
-
- String relNameElement;
- if (relationshipName != null)
- {
- relNameElement = true + relationshipName;
- }
- else
- {
- relNameElement = false + relationshipName;
- }
-
-
- fqn = Fqn.fromElements(RELATIONSHIPS_SEARCH_COMPLEX_NODE, fromName, true, relationshipType.getName(), relNameElement);
- getCache().getRoot().removeChild(fqn);
- fqn = Fqn.fromElements(RELATIONSHIPS_SEARCH_COMPLEX_NODE, toName, false, relationshipType.getName(), relNameElement);
- getCache().getRoot().removeChild(fqn);
-
- if (getLog().isLoggable(Level.FINER))
- {
- getLog().finer(this.toString() + "IdentityObjectRelationship search result invalidated in cache: fromIdentity" +
- fromIdentity.toString() + "; toIdentity=" + toIdentity.toString() +
- "; relationshipType=" + relationshipType.getName() ) ;
- }
-
- }
-
- public void invalidateCachedRelationshipSearches(IdentityObject identity1, IdentityObject identity2, boolean named)
- {
-
- String name1 = identity1.getIdentityType().getName() + "_" + identity1.getName();
- String name2 = identity2.getIdentityType().getName() + "_" + identity2.getName();
-
-
- // Complex search
-
- Fqn fqn = Fqn.fromElements(RELATIONSHIPS_SEARCH_COMPLEX_NODE, name1);
- getCache().getRoot().removeChild(fqn);
- fqn = Fqn.fromElements(RELATIONSHIPS_SEARCH_COMPLEX_NODE, name2);
- getCache().getRoot().removeChild(fqn);
-
- // Simple search
-
- getCache().getRoot().removeChild(Fqn.fromElements(RELATIONSHIPS_SEARCH_SIMPLE_NODE, name1));
- getCache().getRoot().removeChild(Fqn.fromElements(RELATIONSHIPS_SEARCH_SIMPLE_NODE, name2));
-
- fqn = Fqn.fromElements(RELATIONSHIPS_SEARCH_SIMPLE_NODE);
- Set<String> names = getCache().getRoot().getChildrenNames();
-
- for (String childName : names)
- {
- //
- getCache().getRoot().removeChild(Fqn.fromElements(fqn, childName, name1));
- getCache().getRoot().removeChild(Fqn.fromElements(fqn, childName, name2));
- }
-
- if (getLog().isLoggable(Level.FINER))
- {
- getLog().finer(this.toString() + "IdentityObjectRelationship search result invalidated in cache for: identity1" +
- identity1.toString() + "; identity2=" + identity2.toString() +
- "; named=" + named ) ;
- }
-
- }
-
- public void invalidateRelationshipNameSearches(String name)
- {
- //TODO: at the moment it just trash up all relationships searches
-
- removeNodeChildren(RELATIONSHIP_NAMES_SEARCH_ALL_NODE);
- removeNodeChildren(RELATIONSHIP_NAMES_SEARCH_IO_NODE);
-
- if (getLog().isLoggable(Level.FINER))
- {
- getLog().finer(this.toString() + "IdentityObjectRelationshipName search results invalidated in cache: name" +
- name ) ;
- }
- }
-
-
-
- public void putRelationshipNamesSearchIntoCache(IdentityObjectSearchCriteria criteria, Set<String> results)
- {
-
- Fqn fqn = createRelationshipNamesAllSearchFqn(getControlsHash(criteria));
-
- Node node = getCache().getRoot().addChild(fqn);
-
- node.put(NODE_SEARCH_RESULTS_KEY, results);
-
- if (getLog().isLoggable(Level.FINER))
- {
- getLog().finer(this.toString() + "IdentityObjectRelationshipName search results invalidated in cache: criteria hash=" +
- getControlsHash(criteria)) ;
- }
-
- }
-
- public Set<String> getRelationshipNamesSearchFromCache(IdentityObjectSearchCriteria criteria)
- {
-
- Fqn fqn = createRelationshipNamesAllSearchFqn(getControlsHash(criteria));
-
- Node node = getCache().getRoot().getChild(fqn);
-
- if (node != null)
- {
- Set<String> results = (Set<String>)node.get(NODE_SEARCH_RESULTS_KEY);
-
- if (results != null && getLog().isLoggable(Level.FINER))
- {
- getLog().finer(this.toString() + "IdentityObjectRelationshipName search result found in cache: criteria hash=" +
- getControlsHash(criteria)) ;
- }
-
- return results;
- }
-
-
- return null;
- }
-
- public void putRelationshipNamesSearchIntoCache(IdentityObject identity,
- IdentityObjectSearchCriteria criteria,
- Set<String> results)
- {
-
- Fqn fqn = createRelationshipNamesIdentityObjectSearchFqn(identity, getControlsHash(criteria));
-
- Node node = getCache().getRoot().addChild(fqn);
-
- node.put(NODE_SEARCH_RESULTS_KEY, results);
-
- if (results != null && getLog().isLoggable(Level.FINER))
- {
- getLog().finer(this.toString() + "IdentityObjectRelationshipName search result stored in cache: " +
- "criteria hash=" + getControlsHash(criteria) +
- "identity=" + identity.toString()) ;
- }
-
- }
-
- public Set<String> getRelationshipNamesSearchFromCache(IdentityObject identity, IdentityObjectSearchCriteria criteria)
- {
-
-
- Fqn fqn = createRelationshipNamesIdentityObjectSearchFqn(identity, getControlsHash(criteria));
-
- Node node = getCache().getRoot().getChild(fqn);
-
- if (node != null)
- {
- Set<String> results = (Set<String>)node.get(NODE_SEARCH_RESULTS_KEY);
-
- if (results != null && getLog().isLoggable(Level.FINER))
- {
- getLog().finer(this.toString() + "IdentityObjectRelationshipName search result found in cache: " +
- "criteria hash=" + getControlsHash(criteria) +
- "identity=" + identity.toString()) ;
- }
-
- return results;
- }
- return null;
- }
-
- private int getControlsHash(IdentityObjectSearchCriteria criteria)
- {
- // Convert criteria to Set to have the same hashcode regardles order of criteria
- int hashcode = 0;
-
- if (criteria != null)
- {
- hashcode = criteria.hashCode();
- }
-
- return hashcode;
- }
-}
Modified: idm/trunk/idm-cache/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheAPICacheProviderImpl.java
===================================================================
--- idm/trunk/idm-cache/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheAPICacheProviderImpl.java 2009-11-05 12:19:23 UTC (rev 906)
+++ idm/trunk/idm-cache/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheAPICacheProviderImpl.java 2009-11-05 19:23:37 UTC (rev 907)
@@ -23,10 +23,12 @@
import org.jboss.identity.idm.cache.*;
import org.jboss.identity.idm.api.*;
+import org.jboss.identity.idm.api.cfg.IdentityConfigurationRegistry;
import org.jboss.identity.idm.api.query.UserQuery;
import org.jboss.identity.idm.api.query.GroupQuery;
import org.jboss.identity.idm.api.query.RoleQuery;
import org.jboss.identity.idm.impl.api.model.GroupId;
+import org.jboss.identity.idm.common.exception.IdentityException;
import org.jboss.cache.*;
import java.util.Map;
@@ -49,6 +51,12 @@
public static final String CONFIG_FILE_OPTION = "cache.configFile";
+ public static final String CONFIG_CACHE_REGISTRY_OPTION = "cache.cacheRegistryName";
+
+ public static final String CACHE_PROVIDER_REGISTRY_NAME = "cache.providerRegistryName";
+
+ public static final String CACHE_SCOPE = "cache.scope";
+
public static final String NODE_OBJECT_KEY = "object";
public static final String NODE_QUERY_KEY = "query";
@@ -57,6 +65,8 @@
public static final String NODE_MAIN_ROOT = "IDM_ROOT";
+ public static final String NODE_COMMON_ROOT = "COMMON_ROOT";
+
public static final String NODE_USERS = "USERS";
public static final String NODE_USERS_COUNT = "USERS_COUNT";
@@ -110,9 +120,27 @@
return Fqn.fromElements(getNamespacedFqn(ns), node);
}
- public void initialize(Map<String, String> properties)
+ public void initialize(Map<String, String> properties, IdentityConfigurationRegistry configurationRegistry)
{
CacheFactory factory = new DefaultCacheFactory();
+
+ String registryName = properties.get(CONFIG_CACHE_REGISTRY_OPTION);
+
+ // Get cache from registry
+ if (registryName != null)
+ {
+ try
+ {
+ this.cache = (Cache)configurationRegistry.getObject(registryName);
+ }
+ catch (Exception e)
+ {
+ throw new IllegalArgumentException("Cannot find JBoss Cache 'Cache' object in configuration registry with provided" +
+ "name: " + registryName);
+ }
+
+ return;
+ }
String config = properties.get(CONFIG_FILE_OPTION);
@@ -146,11 +174,19 @@
public String getNamespace(String realmId)
{
+ if (realmId == null)
+ {
+ return NODE_COMMON_ROOT;
+ }
return realmId;
}
public String getNamespace(String realmId, String sessionId)
{
+ if (sessionId == null)
+ {
+ return getNamespace(realmId);
+ }
return realmId + "/" + sessionId;
}
Copied: idm/trunk/idm-cache/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheIdentityStoreCacheProviderImpl.java (from rev 906, idm/trunk/idm-cache/src/main/java/org/jboss/identity/idm/impl/cache/IdentityStoreCacheProviderImpl.java)
===================================================================
--- idm/trunk/idm-cache/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheIdentityStoreCacheProviderImpl.java (rev 0)
+++ idm/trunk/idm-cache/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheIdentityStoreCacheProviderImpl.java 2009-11-05 19:23:37 UTC (rev 907)
@@ -0,0 +1,575 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.identity.idm.impl.cache;
+
+import org.jboss.cache.*;
+import org.jboss.identity.idm.spi.model.IdentityObject;
+import org.jboss.identity.idm.spi.model.IdentityObjectAttribute;
+import org.jboss.identity.idm.spi.model.IdentityObjectRelationship;
+import org.jboss.identity.idm.spi.cache.IdentityStoreCacheProvider;
+import org.jboss.identity.idm.spi.cache.IdentityObjectSearch;
+import org.jboss.identity.idm.spi.cache.IdentityObjectRelationshipSearch;
+import org.jboss.identity.idm.spi.cache.IdentityObjectRelationshipNameSearch;
+import org.jboss.identity.idm.spi.configuration.IdentityRepositoryConfigurationContext;
+import org.jboss.identity.idm.impl.types.SimpleIdentityObject;
+import org.jboss.identity.idm.impl.types.SimpleIdentityObjectType;
+import org.jboss.identity.idm.impl.types.SimpleIdentityObjectRelationship;
+import org.jboss.identity.idm.impl.types.SimpleIdentityObjectRelationshipType;
+import org.jboss.identity.idm.impl.api.SimpleAttribute;
+
+import java.util.logging.Logger;
+import java.util.logging.Level;
+import java.util.*;
+
+/**
+ * Helper class providing caching support for IdentityStore.
+ *
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class JBossCacheIdentityStoreCacheProviderImpl implements IdentityStoreCacheProvider
+{
+ private static Logger log = Logger.getLogger(JBossCacheIdentityStoreCacheProviderImpl.class.getName());
+
+
+ private Cache cache;
+
+ public static final String CONFIG_FILE_OPTION = "cache.configFile";
+
+ public static final String CONFIG_CACHE_REGISTRY_OPTION = "cache.cacheRegistryName";
+
+ public static final String NODE_OBJECT_KEY = "object";
+
+ public static final String NODE_SEARCH_KEY = "search";
+
+ public static final String NODE_SEARCH_UNIQUE_KEY = "query_unique";
+
+ public static final String NODE_MAIN_ROOT = "IDM_ROOT";
+
+ public static final String NODE_COMMON_ROOT = "COMMON_ROOT";
+
+ public static final String NODE_IO_COUNT = "NODE_IO_COUNT";
+
+ public static final String NODE_IO_ATTRIBUTES = "NODE_IO_ATTRIBUTES";
+
+ public static final String NODE_REL_PROPS = "NODE_REL_PROPS";
+
+ public static final String NODE_REL_NAME_PROPS = "NODE_REL_NAME_PROPS";
+
+ public static final String NODE_IO_SEARCH = "NODE_IO_SEARCH";
+
+ public static final String NODE_IO_REL_SEARCH = "NODE_IO_REL_SEARCH";
+
+ public static final String NODE_IO_REL_NAME_SEARCH = "NODE_IO_REL_NAME_SEARCH";
+
+ private Fqn getNamespacedFqn(String ns)
+ {
+ return Fqn.fromElements("NODE_MAIN_ROOT", ns);
+ }
+
+ private Fqn getFqn(String ns, String node, Object o)
+ {
+ return Fqn.fromElements(getNamespacedFqn(ns), node, o);
+ }
+
+ private Fqn getFqn(String ns, String node)
+ {
+ return Fqn.fromElements(getNamespacedFqn(ns), node);
+ }
+
+ public void initialize(Map<String, String> properties, IdentityRepositoryConfigurationContext configurationContext)
+ {
+ CacheFactory factory = new DefaultCacheFactory();
+
+ String registryName = properties.get(CONFIG_CACHE_REGISTRY_OPTION);
+
+ // Get cache from registry
+ if (registryName != null)
+ {
+ try
+ {
+ this.cache = (Cache)configurationContext.getConfigurationRegistry().getObject(registryName);
+ }
+ catch (Exception e)
+ {
+ throw new IllegalArgumentException("Cannot find JBoss Cache 'Cache' object in configuration registry with provided" +
+ "name: " + registryName);
+ }
+
+ return;
+ }
+
+ String config = properties.get(CONFIG_FILE_OPTION);
+
+ if (config == null)
+ {
+ throw new IllegalArgumentException("Cannot find '" + CONFIG_FILE_OPTION + "' in passed properties. Failed to initialize" +
+ "cache provider.");
+ }
+
+ this.cache = factory.createCache(config);
+
+ this.cache.create();
+ this.cache.start();
+
+ }
+
+ Cache getCache()
+ {
+ return cache;
+ }
+
+
+ public void invalidate(String ns)
+ {
+ cache.getRoot().removeChild(getNamespacedFqn(ns));
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Invalidating namespace:" + ns);
+ }
+ }
+
+ public String getNamespace(String storeId)
+ {
+ if (storeId == null)
+ {
+ return NODE_COMMON_ROOT;
+ }
+ return storeId;
+ }
+
+ public String getNamespace(String storeId, String sessionId)
+ {
+ if (sessionId == null)
+ {
+ return getNamespace(storeId);
+ }
+ return storeId + "/" + sessionId;
+ }
+
+ public String getNamespace(String storeId, String sessionId, String realmId)
+ {
+ if (realmId == null)
+ {
+ return getNamespace(sessionId);
+ }
+ return storeId + "/" + sessionId + "/" + realmId;
+ }
+
+ public void putIdentityObjectCount(String ns, String type, int count)
+ {
+ Fqn nodeFqn = getFqn(ns, NODE_IO_COUNT, type);
+
+ Node ioNode = getCache().getRoot().addChild(nodeFqn);
+
+ ioNode.put(NODE_OBJECT_KEY, count);
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "IdentityObject count stored in cache: " + count + "; type=" + type);
+ }
+ }
+
+ public int getIdentityObjectCount(String ns, String type)
+ {
+ Fqn nodeFqn = getFqn(ns, NODE_IO_COUNT, type);
+
+ Node node = getCache().getRoot().getChild(nodeFqn);
+
+ if (node != null)
+ {
+ int count = -1;
+ Integer i = (Integer)node.get(NODE_OBJECT_KEY);
+ if (i != null)
+ {
+ count = i;
+ }
+
+ if (log.isLoggable(Level.FINER) && count != -1)
+ {
+ log.finer(this.toString() + "IdentityObject count found in cache: " + count + "; type=" + type);
+ }
+
+ return count;
+ }
+
+ return -1;
+ }
+
+ public void invalidateIdentityObjectCount(String ns, String type)
+ {
+ getCache().getRoot().removeChild(Fqn.fromElements(getNamespacedFqn(ns), NODE_IO_COUNT, type));
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Invalidating IdentityObject count. Namespace:" + ns + "; type=" + type);
+ }
+ }
+
+ public void putIdentityObjectSearch(String ns, IdentityObjectSearch search, Collection<IdentityObject> results)
+ {
+ Fqn nodeFqn = getFqn(ns, NODE_IO_SEARCH, search.hashCode());
+
+ Node ioNode = getCache().getRoot().addChild(nodeFqn);
+
+ ioNode.put(NODE_OBJECT_KEY, safeCopyIO(results));
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "IdentityObject search stored in cache: results.size()=" + results.size());
+ }
+ }
+
+ public Collection<IdentityObject> getIdentityObjectSearch(String ns, IdentityObjectSearch search)
+ {
+ Fqn nodeFqn = getFqn(ns, NODE_IO_SEARCH, search.hashCode());
+
+ Node node = getCache().getRoot().getChild(nodeFqn);
+
+ if (node != null)
+ {
+ Collection<IdentityObject> results = (Collection<IdentityObject>)node.get(NODE_OBJECT_KEY);
+
+ if (log.isLoggable(Level.FINER) && results != null)
+ {
+ log.finer(this.toString() + "IdentityObject search found in cache: results.size()=" + results.size());
+ }
+
+ return results;
+ }
+
+ return null;
+ }
+
+ public void invalidateIdentityObjectSearches(String ns)
+ {
+ getCache().getRoot().removeChild(getFqn(ns, NODE_IO_SEARCH));
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Invalidating IdentityObject searches. Namespace:" + ns);
+ }
+ }
+
+ public void putIdentityObjectRelationshipSearch(String ns, IdentityObjectRelationshipSearch search, Set<IdentityObjectRelationship> results)
+ {
+ Fqn nodeFqn = getFqn(ns, NODE_IO_REL_SEARCH, search.hashCode());
+
+ Node ioNode = getCache().getRoot().addChild(nodeFqn);
+
+ ioNode.put(NODE_OBJECT_KEY, safeCopyIOR(results));
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "IdentityObjectRelationship search stored in cache: results.size()=" + results.size());
+ }
+ }
+
+ public Set<IdentityObjectRelationship> getIdentityObjectRelationshipSearch(String ns, IdentityObjectRelationshipSearch search)
+ {
+ Fqn nodeFqn = getFqn(ns, NODE_IO_REL_SEARCH, search.hashCode());
+
+ Node node = getCache().getRoot().getChild(nodeFqn);
+
+ if (node != null)
+ {
+ Set<IdentityObjectRelationship> results = (Set<IdentityObjectRelationship>)node.get(NODE_OBJECT_KEY);
+
+ if (log.isLoggable(Level.FINER) && results != null)
+ {
+ log.finer(this.toString() + "IdentityObjectRelationship search found in cache: results.size()=" + results.size());
+ }
+
+ return results;
+ }
+
+ return null;
+ }
+
+ public void invalidateIdentityObjectRelationshipSearches(String ns)
+ {
+ getCache().getRoot().removeChild(getFqn(ns, NODE_IO_REL_SEARCH));
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Invalidating IdentityObjectRelationship searches. Namespace:" + ns);
+ }
+ }
+
+ public void putIdentityObjectRelationshipNameSearch(String ns, IdentityObjectRelationshipNameSearch search, Set<String> results)
+ {
+ Fqn nodeFqn = getFqn(ns, NODE_IO_REL_NAME_SEARCH, search.hashCode());
+
+ Node ioNode = getCache().getRoot().addChild(nodeFqn);
+
+ ioNode.put(NODE_OBJECT_KEY, results);
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "IdentityObjectRelationshipName search stored in cache: results.size()=" + results.size());
+ }
+ }
+
+ public Set<String> getIdentityObjectRelationshipNameSearch(String ns, IdentityObjectRelationshipNameSearch search)
+ {
+ Fqn nodeFqn = getFqn(ns, NODE_IO_REL_NAME_SEARCH, search.hashCode());
+
+ Node node = getCache().getRoot().getChild(nodeFqn);
+
+ if (node != null)
+ {
+ Set<String> results = (Set<String>)node.get(NODE_OBJECT_KEY);
+
+ if (log.isLoggable(Level.FINER) && results != null)
+ {
+ log.finer(this.toString() + "IdentityObjectRelationshipName search found in cache: results.size()=" + results.size());
+ }
+
+ return results;
+ }
+
+ return null;
+ }
+
+ public void invalidateIdentityObjectRelationshipNameSearches(String ns)
+ {
+ getCache().getRoot().removeChild(getFqn(ns, NODE_IO_REL_NAME_SEARCH));
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Invalidating IdentityObjectRelationshipName searches. Namespace:" + ns);
+ }
+ }
+
+ public void putProperties(String ns, IdentityObjectRelationship relationship, Map<String, String> properties)
+ {
+ Fqn nodeFqn = getFqn(ns, NODE_REL_PROPS, decode(relationship));
+
+ Node ioNode = getCache().getRoot().addChild(nodeFqn);
+
+ ioNode.put(NODE_OBJECT_KEY, properties);
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "IdentityObjectRelationship properties stored in cache: relationship=" + relationship + "; properties.size()=" + properties.size());
+ }
+ }
+
+ private String decode(IdentityObjectRelationship r)
+ {
+ return r.getFromIdentityObject().getIdentityType().getName() +
+ r.getFromIdentityObject().getName() +
+ r.getToIdentityObject().getIdentityType().getName() +
+ r.getToIdentityObject().getName() +
+ r.getType().getName();
+ }
+
+ public Map<String, String> getProperties(String ns, IdentityObjectRelationship relationship)
+ {
+ Fqn nodeFqn = getFqn(ns, NODE_REL_PROPS, decode(relationship));
+
+ Node node = getCache().getRoot().getChild(nodeFqn);
+
+ if (node != null)
+ {
+ Map<String, String> props = (Map<String, String>)node.get(NODE_OBJECT_KEY);
+
+ if (log.isLoggable(Level.FINER) && props != null)
+ {
+ log.finer(this.toString() + "IdentityObjectRelationship properties found in cache: properties.size()=" + props.size() +
+ "; relationship=" + relationship);
+ }
+
+ return props;
+ }
+
+ return null;
+ }
+
+ public void invalidateRelationshipProperties(String ns, IdentityObjectRelationship relationship)
+ {
+ getCache().getRoot().removeChild(getFqn(ns, NODE_REL_PROPS, decode(relationship)));
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Invalidating IdentityObjectRelationship properties. Namespace:" + ns + "; relationship=" + relationship);
+ }
+ }
+
+ public void invalidateRelationshipProperties(String ns)
+ {
+ getCache().getRoot().removeChild(getFqn(ns, NODE_REL_PROPS));
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Invalidating IdentityObjectRelationship properties. Namespace:" + ns);
+ }
+ }
+
+ public void putProperties(String ns, String name, Map<String, String> properties)
+ {
+ Fqn nodeFqn = getFqn(ns, NODE_REL_NAME_PROPS, name);
+
+ Node ioNode = getCache().getRoot().addChild(nodeFqn);
+
+ ioNode.put(NODE_OBJECT_KEY, properties);
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "IdentityObjectRelationshipName properties stored in cache: name=" + name + "; properties.size()=" + properties.size());
+ }
+ }
+
+ public Map<String, String> getProperties(String ns, String name)
+ {
+ Fqn nodeFqn = getFqn(ns, NODE_REL_NAME_PROPS, name);
+
+ Node node = getCache().getRoot().getChild(nodeFqn);
+
+ if (node != null)
+ {
+ Map<String, String> props = (Map<String, String>)node.get(NODE_OBJECT_KEY);
+
+ if (log.isLoggable(Level.FINER) && props != null)
+ {
+ log.finer(this.toString() + "IdentityObjectRelationshipName properties found in cache: properties.size()=" + props.size() +
+ "; name=" + name);
+ }
+
+ return props;
+ }
+
+ return null;
+ }
+
+ public void invalidateRelationshipNameProperties(String ns, String relationship)
+ {
+ getCache().getRoot().removeChild(getFqn(ns, NODE_REL_NAME_PROPS, relationship));
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Invalidating IdentityObjectRelationshipName properties. Namespace:" + ns + "; name=" + relationship);
+ }
+ }
+
+ public void invalidateRelationshipNameProperties(String ns)
+ {
+ getCache().getRoot().removeChild(getFqn(ns, NODE_REL_NAME_PROPS));
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Invalidating IdentityObjectRelationshipName properties. Namespace:" + ns);
+ }
+
+ }
+
+ public void putIdentityObjectAttributes(String ns, IdentityObject io, Map<String, IdentityObjectAttribute> attributes)
+ {
+ Fqn nodeFqn = getFqn(ns, NODE_IO_ATTRIBUTES, io.getIdentityType().getName() + io.getName());
+
+ Node ioNode = getCache().getRoot().addChild(nodeFqn);
+
+ ioNode.put(NODE_OBJECT_KEY, safeCopyAttr(attributes));
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "IdentityObject attributes stored in cache: io=" + io + "; attributes.size()=" + attributes.size());
+ }
+ }
+
+ public Map<String, IdentityObjectAttribute> getIdentityObjectAttributes(String ns, IdentityObject io)
+ {
+ Fqn nodeFqn = getFqn(ns, NODE_IO_ATTRIBUTES, io.getIdentityType().getName() + io.getName());
+
+ Node node = getCache().getRoot().getChild(nodeFqn);
+
+ if (node != null)
+ {
+ Map<String, IdentityObjectAttribute> props = (Map<String, IdentityObjectAttribute>)node.get(NODE_OBJECT_KEY);
+
+ if (log.isLoggable(Level.FINER) && props != null)
+ {
+ log.finer(this.toString() + "IIdentityObject attributes found in cache: attributes.size()=" + props.size() +
+ "; io=" + io);
+ }
+
+ return props;
+ }
+
+ return null;
+ }
+
+ public void invalidateIdentityObjectAttriubtes(String ns, IdentityObject io)
+ {
+ getCache().getRoot().removeChild(getFqn(ns, NODE_IO_ATTRIBUTES, io.getIdentityType().getName() + io.getName()));
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Invalidating IdentityObject attributes. Namespace:" + ns + "; io=" + io);
+ }
+ }
+
+ public void invalidateIdentityObjectAttriubtes(String ns)
+ {
+ getCache().getRoot().removeChild(getFqn(ns, NODE_IO_ATTRIBUTES));
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Invalidating IdentityObject attributes. Namespace:" + ns);
+ }
+ }
+
+ private List<IdentityObject> safeCopyIO(Collection<IdentityObject> res)
+ {
+ List<IdentityObject> nr = new LinkedList<IdentityObject>();
+
+ for (IdentityObject io : res)
+ {
+ nr.add(new SimpleIdentityObject(io.getName(),
+ new SimpleIdentityObjectType(io.getIdentityType().getName())));
+ }
+
+ return nr;
+ }
+
+ private Set<IdentityObjectRelationship> safeCopyIOR(Set<IdentityObjectRelationship> res)
+ {
+ Set<IdentityObjectRelationship> nr = new HashSet<IdentityObjectRelationship>();
+
+ for (IdentityObjectRelationship ior : res)
+ {
+ IdentityObject from = new SimpleIdentityObject(ior.getFromIdentityObject().getName(),
+ new SimpleIdentityObjectType(ior.getFromIdentityObject().getIdentityType().getName()));
+ IdentityObject to = new SimpleIdentityObject(ior.getToIdentityObject().getName(),
+ new SimpleIdentityObjectType(ior.getToIdentityObject().getIdentityType().getName()));
+
+ nr.add(new SimpleIdentityObjectRelationship(from, to, ior.getName(), new SimpleIdentityObjectRelationshipType(ior.getType().getName())));
+ }
+
+ return nr;
+ }
+
+ private Map<String, IdentityObjectAttribute> safeCopyAttr(Map<String, IdentityObjectAttribute> res)
+ {
+ Map<String, IdentityObjectAttribute> nr = new HashMap<String, IdentityObjectAttribute>();
+
+ for (IdentityObjectAttribute attr : res.values())
+ {
+ nr.put(attr.getName(), new SimpleAttribute(attr));
+ }
+
+ return nr;
+ }
+
+
+}
Modified: idm/trunk/idm-cache/src/test/java/org/jboss/identity/idm/cache/APICacheProviderTestCase.java
===================================================================
--- idm/trunk/idm-cache/src/test/java/org/jboss/identity/idm/cache/APICacheProviderTestCase.java 2009-11-05 12:19:23 UTC (rev 906)
+++ idm/trunk/idm-cache/src/test/java/org/jboss/identity/idm/cache/APICacheProviderTestCase.java 2009-11-05 19:23:37 UTC (rev 907)
@@ -40,7 +40,7 @@
Map<String, String> props = new HashMap<String, String>();
props.put(JBossCacheAPICacheProviderImpl.CONFIG_FILE_OPTION, "jboss-cache.xml");
APICacheProvider cache = new JBossCacheAPICacheProviderImpl();
- cache.initialize(props);
+ cache.initialize(props, null);
String ns = "toto";
@@ -65,9 +65,6 @@
assertNull(cache.getUser(ns, "u2"));
assertNull(cache.getUser(ns, "u3"));
-
-
-
}
}
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/IdentitySearchCriteriaImpl.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/IdentitySearchCriteriaImpl.java 2009-11-05 12:19:23 UTC (rev 906)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/IdentitySearchCriteriaImpl.java 2009-11-05 19:23:37 UTC (rev 907)
@@ -62,6 +62,75 @@
private int firstResult;
+ @Override
+ public boolean equals(Object o)
+ {
+ if (this == o)
+ {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass())
+ {
+ return false;
+ }
+
+ IdentitySearchCriteriaImpl that = (IdentitySearchCriteriaImpl)o;
+
+ if (ascending != that.ascending)
+ {
+ return false;
+ }
+ if (filtered != that.filtered)
+ {
+ return false;
+ }
+ if (firstResult != that.firstResult)
+ {
+ return false;
+ }
+ if (maxResults != that.maxResults)
+ {
+ return false;
+ }
+ if (paged != that.paged)
+ {
+ return false;
+ }
+ if (sorted != that.sorted)
+ {
+ return false;
+ }
+ if (attributes != null ? !attributes.equals(that.attributes) : that.attributes != null)
+ {
+ return false;
+ }
+ if (filter != null ? !filter.equals(that.filter) : that.filter != null)
+ {
+ return false;
+ }
+ if (sortByName != null ? !sortByName.equals(that.sortByName) : that.sortByName != null)
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ int result = (sorted ? 1 : 0);
+ result = 31 * result + (sortByName != null ? sortByName.hashCode() : 0);
+ result = 31 * result + (ascending ? 1 : 0);
+ result = 31 * result + (paged ? 1 : 0);
+ result = 31 * result + firstResult;
+ result = 31 * result + maxResults;
+ result = 31 * result + (filtered ? 1 : 0);
+ result = 31 * result + (attributes != null ? attributes.hashCode() : 0);
+ result = 31 * result + (filter != null ? filter.hashCode() : 0);
+ return result;
+ }
+
private int maxResults;
private boolean filtered = false;
@@ -186,76 +255,7 @@
return attributes;
}
- @Override
- public boolean equals(Object o)
- {
- if (this == o)
- {
- return true;
- }
- if (o == null || getClass() != o.getClass())
- {
- return false;
- }
- IdentitySearchCriteriaImpl that = (IdentitySearchCriteriaImpl)o;
-
- if (ascending != that.ascending)
- {
- return false;
- }
- if (filtered != that.filtered)
- {
- return false;
- }
- if (firstResult != that.firstResult)
- {
- return false;
- }
- if (maxResults != that.maxResults)
- {
- return false;
- }
- if (paged != that.paged)
- {
- return false;
- }
- if (sorted != that.sorted)
- {
- return false;
- }
- if (!attributes.equals(that.attributes))
- {
- return false;
- }
- if (filter != null ? !filter.equals(that.filter) : that.filter != null)
- {
- return false;
- }
- if (sortByName != null ? !sortByName.equals(that.sortByName) : that.sortByName != null)
- {
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode()
- {
- int result = (sorted ? 1 : 0);
- result = 31 * result + (sortByName != null ? sortByName.hashCode() : 0);
- result = 31 * result + (ascending ? 1 : 0);
- result = 31 * result + (paged ? 1 : 0);
- result = 31 * result + firstResult;
- result = 31 * result + maxResults;
- result = 31 * result + (filtered ? 1 : 0);
- result = 31 * result + attributes.hashCode();
- result = 31 * result + (filter != null ? filter.hashCode() : 0);
- return result;
- }
-
-
// Static helper methods:
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/IdentitySessionFactoryImpl.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/IdentitySessionFactoryImpl.java 2009-11-05 12:19:23 UTC (rev 906)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/IdentitySessionFactoryImpl.java 2009-11-05 19:23:37 UTC (rev 907)
@@ -75,7 +75,11 @@
IdentitySession newSession =
new IdentitySessionImpl(sessionConfigCtx.getRealmName(),
- sessionConfigCtx.getRepository(), sessionConfigCtx.getTypeMapper(), sessionConfigCtx.getApiCacheProvider());
+ sessionConfigCtx.getRepository(),
+ sessionConfigCtx.getTypeMapper(),
+ sessionConfigCtx.getApiCacheProvider(),
+ sessionConfigCtx.getIdentityConfigurationContext(),
+ sessionConfigCtx.getRealmOptions());
realmMap.put(realmName, newSession);
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/IdentitySessionImpl.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/IdentitySessionImpl.java 2009-11-05 12:19:23 UTC (rev 906)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/IdentitySessionImpl.java 2009-11-05 19:23:37 UTC (rev 907)
@@ -26,6 +26,7 @@
import java.util.Collection;
import java.util.List;
import java.util.LinkedList;
+import java.util.Map;
import org.jboss.identity.idm.api.IdentitySession;
import org.jboss.identity.idm.api.Transaction;
@@ -49,6 +50,7 @@
import org.jboss.identity.idm.spi.store.IdentityStoreSession;
import org.jboss.identity.idm.spi.store.IdentityStoreInvocationContext;
import org.jboss.identity.idm.spi.repository.IdentityStoreRepository;
+import org.jboss.identity.idm.spi.configuration.IdentityConfigurationContext;
import org.jboss.identity.idm.impl.store.SimpleIdentityStoreInvocationContext;
import org.jboss.identity.idm.impl.api.session.context.IdentitySessionContext;
import org.jboss.identity.idm.impl.api.session.context.IdentitySessionContextImpl;
@@ -111,12 +113,14 @@
public IdentitySessionImpl(String realmName,
IdentityStoreRepository repository,
IdentityObjectTypeMapper typeMapper,
- APICacheProvider apiCacheProvider) throws IdentityException
+ APICacheProvider apiCacheProvider,
+ IdentityConfigurationContext configurationContext,
+ Map<String, List<String>> realmOptions) throws IdentityException
{
this.realmName = realmName;
IdentityStoreSession storeSession = repository.createIdentityStoreSession();
- final IdentityStoreInvocationContext invocationCtx = new SimpleIdentityStoreInvocationContext(storeSession, realmName);
+ final IdentityStoreInvocationContext invocationCtx = new SimpleIdentityStoreInvocationContext(storeSession, realmName, String.valueOf(this.hashCode()));
IdentityStoreInvocationContextResolver resolver = new IdentityStoreInvocationContextResolver()
{
@@ -138,9 +142,21 @@
this.apiCacheProvider = apiCacheProvider;
+
+
if (apiCacheProvider != null)
{
- cacheNS = apiCacheProvider.getNamespace(realmName);
+ // Find cache scope
+ List<String> cacheScope = realmOptions.get("cache.scope");
+
+ if (cacheScope != null && cacheScope.size() > 1 && cacheScope.get(0).equals("session"))
+ {
+ cacheNS = apiCacheProvider.getNamespace(realmName, String.valueOf(this.hashCode()));
+ }
+ else
+ {
+ cacheNS = apiCacheProvider.getNamespace(realmName);
+ }
}
else
{
@@ -149,10 +165,12 @@
}
+ public String getId()
+ {
+ return String.valueOf(this.hashCode());
+ }
-
-
public String getRealmName()
{
return realmName;
Added: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/AbstractSPISearchImpl.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/AbstractSPISearchImpl.java (rev 0)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/AbstractSPISearchImpl.java 2009-11-05 19:23:37 UTC (rev 907)
@@ -0,0 +1,42 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2009, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* 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.identity.idm.impl.cache;
+
+import org.jboss.identity.idm.spi.cache.Search;
+import org.jboss.identity.idm.spi.search.IdentityObjectSearchCriteria;
+
+public class AbstractSPISearchImpl implements Search
+{
+ private IdentityObjectSearchCriteria identityObjectSearchCriteria;
+
+ public IdentityObjectSearchCriteria getIdentityObjectSearchCriteria()
+ {
+ return identityObjectSearchCriteria;
+ }
+
+ public void setIdentityObjectSearchCriteria(IdentityObjectSearchCriteria identityObjectSearchCriteria)
+ {
+ this.identityObjectSearchCriteria = identityObjectSearchCriteria;
+ }
+}
Added: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/IdentityObjectRelationshipNameSearchImpl.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/IdentityObjectRelationshipNameSearchImpl.java (rev 0)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/IdentityObjectRelationshipNameSearchImpl.java 2009-11-05 19:23:37 UTC (rev 907)
@@ -0,0 +1,88 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2009, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* 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.identity.idm.impl.cache;
+
+import org.jboss.identity.idm.spi.cache.IdentityObjectRelationshipNameSearch;
+
+public class IdentityObjectRelationshipNameSearchImpl extends AbstractSPISearchImpl implements IdentityObjectRelationshipNameSearch
+{
+
+ private String ioName;
+
+ private String ioType;
+
+ public String getIoName()
+ {
+ return ioName;
+ }
+
+ public void setIoName(String ioName)
+ {
+ this.ioName = ioName;
+ }
+
+ public String getIoType()
+ {
+ return ioType;
+ }
+
+ public void setIoType(String ioType)
+ {
+ this.ioType = ioType;
+ }
+
+ @Override
+ public boolean equals(Object o)
+ {
+ if (this == o)
+ {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass())
+ {
+ return false;
+ }
+
+ IdentityObjectRelationshipNameSearchImpl that = (IdentityObjectRelationshipNameSearchImpl)o;
+
+ if (ioName != null ? !ioName.equals(that.ioName) : that.ioName != null)
+ {
+ return false;
+ }
+ if (ioType != null ? !ioType.equals(that.ioType) : that.ioType != null)
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ int result = ioName != null ? ioName.hashCode() : 0;
+ result = 31 * result + (ioType != null ? ioType.hashCode() : 0);
+ return result;
+ }
+}
Added: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/IdentityObjectRelationshipSearchImpl.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/IdentityObjectRelationshipSearchImpl.java (rev 0)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/IdentityObjectRelationshipSearchImpl.java 2009-11-05 19:23:37 UTC (rev 907)
@@ -0,0 +1,209 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2009, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* 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.identity.idm.impl.cache;
+
+import org.jboss.identity.idm.spi.cache.IdentityObjectRelationshipSearch;
+
+public class IdentityObjectRelationshipSearchImpl extends AbstractSPISearchImpl implements IdentityObjectRelationshipSearch
+{
+
+ private String fromIOName;
+
+ private String fromIOType;
+
+ private String toIOName;
+
+ private String toIOType;
+
+ private String relationshipType;
+
+ private String ioName;
+
+ private String ioType;
+
+ private boolean parent;
+
+ private boolean named;
+
+ private String name;
+
+ public String getFromIOName()
+ {
+ return fromIOName;
+ }
+
+ public void setFromIOName(String fromIOName)
+ {
+ this.fromIOName = fromIOName;
+ }
+
+ public String getFromIOType()
+ {
+ return fromIOType;
+ }
+
+ public void setFromIOType(String fromIOType)
+ {
+ this.fromIOType = fromIOType;
+ }
+
+ public String getToIOName()
+ {
+ return toIOName;
+ }
+
+ public void setToIOName(String toIOName)
+ {
+ this.toIOName = toIOName;
+ }
+
+ public String getToIOType()
+ {
+ return toIOType;
+ }
+
+ public void setToIOType(String toIOType)
+ {
+ this.toIOType = toIOType;
+ }
+
+ public String getRelationshipType()
+ {
+ return relationshipType;
+ }
+
+ public void setRelationshipType(String relationshipType)
+ {
+ this.relationshipType = relationshipType;
+ }
+
+ public String getIoName()
+ {
+ return ioName;
+ }
+
+ public void setIoName(String ioName)
+ {
+ this.ioName = ioName;
+ }
+
+ public String getIoType()
+ {
+ return ioType;
+ }
+
+ public void setIoType(String ioType)
+ {
+ this.ioType = ioType;
+ }
+
+ public boolean isParent()
+ {
+ return parent;
+ }
+
+ public void setParent(boolean parent)
+ {
+ this.parent = parent;
+ }
+
+ public boolean isNamed()
+ {
+ return named;
+ }
+
+ public void setNamed(boolean named)
+ {
+ this.named = named;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+
+ @Override
+ public boolean equals(Object o)
+ {
+ if (this == o)
+ {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass())
+ {
+ return false;
+ }
+
+ IdentityObjectRelationshipSearchImpl that = (IdentityObjectRelationshipSearchImpl)o;
+
+ if (named != that.named)
+ {
+ return false;
+ }
+ if (parent != that.parent)
+ {
+ return false;
+ }
+ if (fromIOName != null ? !fromIOName.equals(that.fromIOName) : that.fromIOName != null)
+ {
+ return false;
+ }
+ if (fromIOType != null ? !fromIOType.equals(that.fromIOType) : that.fromIOType != null)
+ {
+ return false;
+ }
+ if (ioName != null ? !ioName.equals(that.ioName) : that.ioName != null)
+ {
+ return false;
+ }
+ if (ioType != null ? !ioType.equals(that.ioType) : that.ioType != null)
+ {
+ return false;
+ }
+ if (name != null ? !name.equals(that.name) : that.name != null)
+ {
+ return false;
+ }
+ if (relationshipType != null ? !relationshipType.equals(that.relationshipType) : that.relationshipType != null)
+ {
+ return false;
+ }
+ if (toIOName != null ? !toIOName.equals(that.toIOName) : that.toIOName != null)
+ {
+ return false;
+ }
+ if (toIOType != null ? !toIOType.equals(that.toIOType) : that.toIOType != null)
+ {
+ return false;
+ }
+
+ return true;
+ }
+}
Added: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/IdentityObjectSearchImpl.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/IdentityObjectSearchImpl.java (rev 0)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/IdentityObjectSearchImpl.java 2009-11-05 19:23:37 UTC (rev 907)
@@ -0,0 +1,172 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2009, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* 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.identity.idm.impl.cache;
+
+import org.jboss.identity.idm.spi.cache.IdentityObjectSearch;
+
+public class IdentityObjectSearchImpl extends AbstractSPISearchImpl implements IdentityObjectSearch
+{
+ private String id;
+
+ private String name;
+
+ private String type;
+
+ private String relationshipType;
+
+ private String relatedIOName;
+
+ private String relatedIOType;
+
+ private boolean parent;
+
+ public String getId()
+ {
+ return id;
+ }
+
+ public void setId(String id)
+ {
+ this.id = id;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public String getType()
+ {
+ return type;
+ }
+
+ public void setType(String type)
+ {
+ this.type = type;
+ }
+
+ public String getRelatedIOName()
+ {
+ return relatedIOName;
+ }
+
+ public void setRelatedIOName(String relatedIOName)
+ {
+ this.relatedIOName = relatedIOName;
+ }
+
+ public String getRelatedIOType()
+ {
+ return relatedIOType;
+ }
+
+ public void setRelatedIOType(String relatedIOType)
+ {
+ this.relatedIOType = relatedIOType;
+ }
+
+ public boolean isParent()
+ {
+ return parent;
+ }
+
+ public void setParent(boolean parent)
+ {
+ this.parent = parent;
+ }
+
+ public String getRelationshipType()
+ {
+ return relationshipType;
+ }
+
+ public void setRelationshipType(String relationshipType)
+ {
+ this.relationshipType = relationshipType;
+ }
+
+ @Override
+ public boolean equals(Object o)
+ {
+ if (this == o)
+ {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass())
+ {
+ return false;
+ }
+
+ IdentityObjectSearchImpl that = (IdentityObjectSearchImpl)o;
+
+ if (parent != that.parent)
+ {
+ return false;
+ }
+ if (id != null ? !id.equals(that.id) : that.id != null)
+ {
+ return false;
+ }
+ if (name != null ? !name.equals(that.name) : that.name != null)
+ {
+ return false;
+ }
+ if (relatedIOName != null ? !relatedIOName.equals(that.relatedIOName) : that.relatedIOName != null)
+ {
+ return false;
+ }
+ if (relatedIOType != null ? !relatedIOType.equals(that.relatedIOType) : that.relatedIOType != null)
+ {
+ return false;
+ }
+ if (relationshipType != null ? !relationshipType.equals(that.relationshipType) : that.relationshipType != null)
+ {
+ return false;
+ }
+ if (type != null ? !type.equals(that.type) : that.type != null)
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ int result = id != null ? id.hashCode() : 0;
+ result = 31 * result + (name != null ? name.hashCode() : 0);
+ result = 31 * result + (type != null ? type.hashCode() : 0);
+ result = 31 * result + (relationshipType != null ? relationshipType.hashCode() : 0);
+ result = 31 * result + (relatedIOName != null ? relatedIOName.hashCode() : 0);
+ result = 31 * result + (relatedIOType != null ? relatedIOType.hashCode() : 0);
+ result = 31 * result + (parent ? 1 : 0);
+ return result;
+ }
+}
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheAttributeStoreWrapper.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheAttributeStoreWrapper.java 2009-11-05 12:19:23 UTC (rev 906)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheAttributeStoreWrapper.java 2009-11-05 19:23:37 UTC (rev 907)
@@ -49,18 +49,31 @@
protected final IdentityStoreCacheProvider cacheSupport;
- // if update/add/remove operation on attributes should result in getAttributes() query to store new set in cache
- // with many updates it can add additional cost
- private boolean reloadAttributesToCacheOnUpdate = true;
+ protected final String cacheScope;
-
- public JBossCacheAttributeStoreWrapper(AttributeStore attributeStore, IdentityStoreCacheProvider cacheSupport)
+ public JBossCacheAttributeStoreWrapper(AttributeStore attributeStore, IdentityStoreCacheProvider cacheSupport, String cacheScope)
{
- //cacheSupport = new IdentityStoreCacheSupportImpl(cacheConfigInputStream);
this.cacheSupport = cacheSupport;
this.attributeStore = attributeStore;
+ this.cacheScope = cacheScope;
}
+ protected String getCacheNS(IdentityStoreInvocationContext ctx)
+ {
+
+ if (cacheScope != null && cacheScope.equals("realm"))
+ {
+ return cacheSupport.getNamespace(attributeStore.getId(), ctx.getRealmId());
+ }
+ if (cacheScope != null && cacheScope.equals("session"))
+ {
+ return cacheSupport.getNamespace(attributeStore.getId(), ctx.getRealmId(), ctx.getSessionId());
+ }
+
+ return cacheSupport.getNamespace(attributeStore.getId());
+
+ }
+
public String getId()
{
return attributeStore.getId();
@@ -88,19 +101,18 @@
public Map<String, IdentityObjectAttribute> getAttributes(IdentityStoreInvocationContext invocationContext,
IdentityObject identity) throws IdentityException
{
- Map<String, IdentityObjectAttribute> results = cacheSupport.getAttributesFromCache(identity.getName(), identity.getIdentityType());
- if (results == null)
+ Map<String, IdentityObjectAttribute> results = cacheSupport.getIdentityObjectAttributes(getCacheNS(invocationContext), identity);
+ if (results != null)
{
- results = attributeStore.getAttributes(invocationContext, identity);
-
- if (results != null && results.size() > 0)
- {
- //TODO:FIXME
-// cacheSupport.putIntoCache(identity, results);
- }
+ return results;
}
+ results = attributeStore.getAttributes(invocationContext, identity);
+
+ cacheSupport.putIdentityObjectAttributes(getCacheNS(invocationContext), identity, results);
+
+
return results;
}
@@ -108,18 +120,22 @@
IdentityObject identity,
String name) throws IdentityException
{
- Map<String, IdentityObjectAttribute> results = cacheSupport.getAttributesFromCache(identity.getName(), identity.getIdentityType());
+ Map<String, IdentityObjectAttribute> results = cacheSupport.getIdentityObjectAttributes(getCacheNS(invocationContext), identity);
if (results != null && results.containsKey(name))
{
return results.get(name);
}
- else
- {
- return attributeStore.getAttribute(invocationContext, identity, name);
- //TODO: add this attribute to the node map
+ IdentityObjectAttribute result = attributeStore.getAttribute(invocationContext, identity, name);
+
+ // Put fresh attributes in cache
+ if (result != null)
+ {
+ cacheSupport.invalidateIdentityObjectAttriubtes(getCacheNS(invocationContext), identity);
+ cacheSupport.putIdentityObjectAttributes(getCacheNS(invocationContext), identity, attributeStore.getAttributes(invocationContext, identity));
}
+ return result;
}
@@ -129,23 +145,8 @@
{
attributeStore.updateAttributes(invocationCtx, identity, attributes);
- cacheSupport.removeAttributesFromCache(identity);
-
- if (reloadAttributesToCacheOnUpdate)
- {
- Map<String, IdentityObjectAttribute> results = attributeStore.getAttributes(invocationCtx, identity);
-
- if (results != null && results.size() > 0)
- {
- //TODO:FIXME
-// cacheSupport.putIntoCache(identity, results);
- }
- }
- else
- {
- // update attributes in node map directly
- }
-
+ cacheSupport.invalidateIdentityObjectAttriubtes(getCacheNS(invocationCtx), identity);
+ cacheSupport.putIdentityObjectAttributes(getCacheNS(invocationCtx), identity, attributeStore.getAttributes(invocationCtx, identity));
}
public void addAttributes(IdentityStoreInvocationContext invocationCtx,
@@ -154,22 +155,8 @@
{
attributeStore.addAttributes(invocationCtx, identity, attributes);
- cacheSupport.removeAttributesFromCache(identity);
-
- if (reloadAttributesToCacheOnUpdate)
- {
- Map<String, IdentityObjectAttribute> results = attributeStore.getAttributes(invocationCtx, identity);
-
- if (results != null && results.size() > 0)
- {
- //TODO:FIXME
-// cacheSupport.putIntoCache(identity, results);
- }
- }
- else
- {
- // add attributes in node map directly
- }
+ cacheSupport.invalidateIdentityObjectAttriubtes(getCacheNS(invocationCtx), identity);
+ cacheSupport.putIdentityObjectAttributes(getCacheNS(invocationCtx), identity, attributeStore.getAttributes(invocationCtx, identity));
}
public void removeAttributes(IdentityStoreInvocationContext invocationCtx,
@@ -178,24 +165,11 @@
{
attributeStore.removeAttributes(invocationCtx, identity, attributeNames);
- cacheSupport.removeAttributesFromCache(identity);
-
- if (reloadAttributesToCacheOnUpdate)
- {
- Map<String, IdentityObjectAttribute> results = attributeStore.getAttributes(invocationCtx, identity);
-
- if (results != null && results.size() > 0)
- {
- cacheSupport.putIntoCache(identity, results);
- }
- }
- else
- {
- // remove attributes in node map directly
- }
+ cacheSupport.invalidateIdentityObjectAttriubtes(getCacheNS(invocationCtx), identity);
+ cacheSupport.putIdentityObjectAttributes(getCacheNS(invocationCtx), identity, attributeStore.getAttributes(invocationCtx, identity));
}
- //TODO:
+ //TODO: cache
public IdentityObject findIdentityObjectByUniqueAttribute(IdentityStoreInvocationContext invocationCtx, IdentityObjectType identityObjectType, IdentityObjectAttribute attribute) throws IdentityException
{
return attributeStore.findIdentityObjectByUniqueAttribute(invocationCtx, identityObjectType, attribute);
@@ -207,11 +181,6 @@
return log;
}
-// protected Cache getCache()
-// {
-// return cache;
-// }
-
@Override
public String toString()
{
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheIdentityStoreWrapper.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheIdentityStoreWrapper.java 2009-11-05 12:19:23 UTC (rev 906)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheIdentityStoreWrapper.java 2009-11-05 19:23:37 UTC (rev 907)
@@ -35,10 +35,12 @@
import org.jboss.identity.idm.spi.search.IdentityObjectSearchCriteria;
import org.jboss.identity.idm.spi.cache.IdentityStoreCacheProvider;
import org.jboss.identity.idm.common.exception.IdentityException;
+import org.jboss.identity.idm.impl.types.SimpleIdentityObjectRelationship;
import java.util.Map;
import java.util.Collection;
import java.util.Set;
+import java.util.HashSet;
import java.util.logging.Logger;
/**
@@ -57,20 +59,15 @@
private final IdentityStore identityStore;
- public JBossCacheIdentityStoreWrapper(IdentityStore identityStore, IdentityStoreCacheProvider cacheSupport) throws IdentityException
+ public JBossCacheIdentityStoreWrapper(IdentityStore identityStore, IdentityStoreCacheProvider cacheSupport, String cacheNS) throws IdentityException
{
- super(identityStore, cacheSupport);
+ super(identityStore, cacheSupport, cacheNS);
this.identityStore = identityStore;
-
-
- cacheSupport.initResidentNodes(identityStore.getSupportedFeatures().getSupportedIdentityObjectTypes(),
- identityStore.getSupportedFeatures().getSupportedRelationshipTypes());
-
log.fine("------------------------------------------------------");
log.fine("JBossCacheIdentityStoreWrapper created ....." +
- "(IdentityStore: " + identityStore.getId() + ")");
+ "(IdentityStore: " + identityStore.getId() + "; cache namespace: " + cacheNS + ")");
log.fine("------------------------------------------------------");
}
@@ -93,15 +90,19 @@
String name,
IdentityObjectType identityObjectType) throws IdentityException
{
+
+
IdentityObject io = identityStore.createIdentityObject(invocationCtx, name, identityObjectType);
+
+
if (io != null)
{
- //should also invalidate IO searches cache - searches/type - clear all children
- cacheSupport.invalidateCachedIdentityObjectSearches(io);
- cacheSupport.invalidateCachedIdentityObjectCount(identityObjectType);
+ cacheSupport.invalidateIdentityObjectRelationshipNameSearches(getCacheNS(invocationCtx));
+ cacheSupport.invalidateIdentityObjectRelationshipSearches(getCacheNS(invocationCtx));
+ cacheSupport.invalidateIdentityObjectSearches(getCacheNS(invocationCtx));
+ cacheSupport.invalidateIdentityObjectCount(getCacheNS(invocationCtx), identityObjectType.getName());
- cacheSupport.putIntoCache(io);
}
return io;
}
@@ -115,16 +116,15 @@
{
IdentityObject io = identityStore.createIdentityObject(invocationCtx, name, identityObjectType, attributes);
-
-
if (io != null)
{
- //should also invalidate IO searches cache - searches/type - clear all children
- cacheSupport.invalidateCachedIdentityObjectSearches(io);
- //grab profile - because IS can add extra attributes we canno rely only on attributes passed
+ cacheSupport.invalidateIdentityObjectRelationshipNameSearches(getCacheNS(invocationCtx));
+ cacheSupport.invalidateIdentityObjectRelationshipSearches(getCacheNS(invocationCtx));
+ cacheSupport.invalidateIdentityObjectSearches(getCacheNS(invocationCtx));
+ cacheSupport.invalidateIdentityObjectCount(getCacheNS(invocationCtx), identityObjectType.getName());
- cacheSupport.putIntoCache(io, identityStore.getAttributes(invocationCtx, io));
+
}
return io;
}
@@ -134,56 +134,81 @@
{
identityStore.removeIdentityObject(invocationCtx, identity);
- cacheSupport.removeFromCache(identity);
+ cacheSupport.invalidateIdentityObjectRelationshipNameSearches(getCacheNS(invocationCtx));
+ cacheSupport.invalidateIdentityObjectRelationshipSearches(getCacheNS(invocationCtx));
+ cacheSupport.invalidateIdentityObjectSearches(getCacheNS(invocationCtx));
+ cacheSupport.invalidateIdentityObjectAttriubtes(getCacheNS(invocationCtx), identity);
+ cacheSupport.invalidateIdentityObjectCount(getCacheNS(invocationCtx), identity.getIdentityType().getName());
- cacheSupport.invalidateCachedIdentityObjectSearches(identity);
- cacheSupport.invalidateCachedIdentityObjectCount(identity.getIdentityType());
}
public int getIdentityObjectsCount(IdentityStoreInvocationContext invocationCtx,
IdentityObjectType identityType) throws IdentityException
{
- int count = cacheSupport.getIdentityObjectCountFromCache(identityType);
+ int count = cacheSupport.getIdentityObjectCount(getCacheNS(invocationCtx), identityType.getName());
- if (count == -1)
+ if (count != -1)
{
- count = identityStore.getIdentityObjectsCount(invocationCtx, identityType);
-
- cacheSupport.putIdentityObjectCountIntoCache(identityType, count);
+ return count;
}
+ count = identityStore.getIdentityObjectsCount(invocationCtx, identityType);
+ cacheSupport.putIdentityObjectCount(getCacheNS(invocationCtx), identityType.getName(), count);
+
return count;
}
-
-
public IdentityObject findIdentityObject(IdentityStoreInvocationContext invocationContext,
String name,
IdentityObjectType identityObjectType) throws IdentityException
{
- IdentityObject io = cacheSupport.getFromCache(name, identityObjectType);
+ IdentityObjectSearchImpl search = new IdentityObjectSearchImpl();
+ search.setName(name);
+ if (identityObjectType != null)
+ {
+ search.setType(identityObjectType.getName());
+ }
+ Collection<IdentityObject> results = cacheSupport.getIdentityObjectSearch(getCacheNS(invocationContext), search);
- if (io == null)
+ if (results != null && results.size() == 1)
{
- io = identityStore.findIdentityObject(invocationContext, name, identityObjectType);
- cacheSupport.putIntoCache(io);
- return io;
+ return results.iterator().next();
}
+ IdentityObject io = identityStore.findIdentityObject(invocationContext, name, identityObjectType);
+
+ if (io != null)
+ {
+ Set<IdentityObject> temp = new HashSet<IdentityObject>();
+ temp.add(io);
+ cacheSupport.putIdentityObjectSearch(getCacheNS(invocationContext), search, temp);
+ }
+
return io;
}
public IdentityObject findIdentityObject(IdentityStoreInvocationContext invocationContext,
String id) throws IdentityException
{
- IdentityObject io = cacheSupport.getFromCache(id);
- if (io == null)
+ IdentityObjectSearchImpl search = new IdentityObjectSearchImpl();
+ search.setId(id);
+
+ Collection<IdentityObject> results = cacheSupport.getIdentityObjectSearch(getCacheNS(invocationContext), search);
+
+ if (results != null && results.size() == 1)
+ {
+ return results.iterator().next();
+ }
+
+ IdentityObject io = identityStore.findIdentityObject(invocationContext, id);
+
+ if (io != null)
{
- io = identityStore.findIdentityObject(invocationContext, id);
- cacheSupport.putIntoCache(io);
- return io;
+ Set<IdentityObject> temp = new HashSet<IdentityObject>();
+ temp.add(io);
+ cacheSupport.putIdentityObjectSearch(getCacheNS(invocationContext), search, temp);
}
return io;
@@ -194,21 +219,26 @@
IdentityObjectSearchCriteria criteria) throws IdentityException
{
- Collection<IdentityObject> results = cacheSupport.getIdentityObjectSearchFromCache(identityType, criteria);
+ //TODO: fix
- if (results == null)
- {
- results = identityStore.findIdentityObject(invocationCtx, identityType, criteria);
+// IdentityObjectSearchImpl search = new IdentityObjectSearchImpl();
+// search.setIdentityObjectSearchCriteria(criteria);
+// if (identityType != null)
+// {
+// search.setType(identityType.getName());
+// }
- cacheSupport.putIdentityObjectSearchIntoCache(identityType, criteria, results);
+// Collection<IdentityObject> results = cacheSupport.getIdentityObjectSearch(getCacheNS(invocationCtx), search);
- // Put all the results into cache separately
- for (IdentityObject result : results)
- {
- cacheSupport.putIntoCache(result);
- }
- }
+// if (results != null)
+// {
+// return results;
+// }
+ Collection<IdentityObject> results = identityStore.findIdentityObject(invocationCtx, identityType, criteria);
+
+// cacheSupport.putIdentityObjectSearch(getCacheNS(invocationCtx), search, results);
+
return results;
@@ -224,19 +254,31 @@
IdentityObjectSearchCriteria criteria) throws IdentityException
{
- Collection<IdentityObject> results = cacheSupport.getIdentityObjectSearchFromCache(identity, relationshipType, parent, criteria);
+ IdentityObjectSearchImpl search = new IdentityObjectSearchImpl();
+ search.setIdentityObjectSearchCriteria(criteria);
+ search.setParent(parent);
+ if (relationshipType != null)
+ {
+ search.setRelationshipType(relationshipType.getName());
+ }
+ if (identity != null)
+ {
+ search.setName(identity.getName());
+ search.setType(identity.getIdentityType().getName());
+ }
- if (results == null)
+ Collection<IdentityObject> results = cacheSupport.getIdentityObjectSearch(getCacheNS(invocationCtx), search);
+
+ if (results != null)
{
- results = identityStore.findIdentityObject(invocationCtx, identity, relationshipType, parent, criteria);
+ //TODO
+ return results;
+ }
- cacheSupport.putIdentityObjectSearchToCache(identity, relationshipType,parent,criteria, results);
+ results = identityStore.findIdentityObject(invocationCtx, identity, relationshipType, parent, criteria);
- for (IdentityObject result : results)
- {
- cacheSupport.putIntoCache(result);
- }
- }
+ cacheSupport.putIdentityObjectSearch(getCacheNS(invocationCtx), search, results);
+
return results;
}
@@ -250,7 +292,9 @@
String relationshipName,
boolean createNames) throws IdentityException
{
- cacheSupport.invalidateCachedRelationshipSearches(fromIdentity, toIdentity, relationshipType, relationshipName);
+ cacheSupport.invalidateIdentityObjectRelationshipNameSearches(getCacheNS(invocationCxt));
+ cacheSupport.invalidateIdentityObjectRelationshipSearches(getCacheNS(invocationCxt));
+ cacheSupport.invalidateIdentityObjectSearches(getCacheNS(invocationCxt));
return identityStore.createRelationship(invocationCxt,
fromIdentity, toIdentity, relationshipType, relationshipName, createNames);
@@ -266,8 +310,12 @@
{
identityStore.removeRelationship(invocationCxt, fromIdentity, toIdentity, relationshipType, relationshipName);
- cacheSupport.invalidateCachedRelationshipSearches(fromIdentity, toIdentity, relationshipType, relationshipName);
-
+ cacheSupport.invalidateIdentityObjectRelationshipNameSearches(getCacheNS(invocationCxt));
+ cacheSupport.invalidateIdentityObjectRelationshipSearches(getCacheNS(invocationCxt));
+ cacheSupport.invalidateIdentityObjectSearches(getCacheNS(invocationCxt));
+ IdentityObjectRelationship relationship = new SimpleIdentityObjectRelationship(fromIdentity, toIdentity, relationshipName, relationshipType);
+ cacheSupport.invalidateRelationshipProperties(getCacheNS(invocationCxt), relationship);
+
}
@@ -280,8 +328,10 @@
{
identityStore.removeRelationships(invocationCtx, identity1, identity2, named);
- cacheSupport.invalidateCachedRelationshipSearches(identity1, identity2, named);
-
+ cacheSupport.invalidateIdentityObjectRelationshipNameSearches(getCacheNS(invocationCtx));
+ cacheSupport.invalidateIdentityObjectRelationshipSearches(getCacheNS(invocationCtx));
+ cacheSupport.invalidateIdentityObjectSearches(getCacheNS(invocationCtx));
+ cacheSupport.invalidateRelationshipProperties(getCacheNS(invocationCtx));
}
@@ -291,16 +341,33 @@
IdentityObjectRelationshipType relationshipType) throws IdentityException
{
+ IdentityObjectRelationshipSearchImpl search = new IdentityObjectRelationshipSearchImpl();
+ if (fromIdentity != null)
+ {
+ search.setFromIOName(fromIdentity.getName());
+ search.setFromIOType(fromIdentity.getIdentityType().getName());
+ }
+ if (toIdentity != null)
+ {
+ search.setToIOName(toIdentity.getName());
+ search.setToIOType(toIdentity.getIdentityType().getName());
+ }
+ if (relationshipType != null)
+ {
+ search.setRelationshipType(relationshipType.getName());
+ }
+
+ Set<IdentityObjectRelationship> results = cacheSupport.getIdentityObjectRelationshipSearch(getCacheNS(invocationCxt), search);
- Set<IdentityObjectRelationship> results = cacheSupport.getRelationshipsSearchFromCache(fromIdentity, toIdentity, relationshipType);
-
- if (results == null)
+ if (results != null)
{
- results = identityStore.resolveRelationships(invocationCxt, fromIdentity, toIdentity, relationshipType);
-
- cacheSupport.putRelationshipsSearchIntoCache(fromIdentity, toIdentity, relationshipType, results);
+ return results;
}
+ results = identityStore.resolveRelationships(invocationCxt, fromIdentity, toIdentity, relationshipType);
+
+ cacheSupport.putIdentityObjectRelationshipSearch(getCacheNS(invocationCxt), search, results);
+
return results;
}
@@ -312,16 +379,34 @@
boolean named,
String name) throws IdentityException
{
- Set<IdentityObjectRelationship> results = cacheSupport.getRelationshipsSearchFromCache(identity, relationshipType, parent, named, name);
- if (results == null)
+ IdentityObjectRelationshipSearchImpl search = new IdentityObjectRelationshipSearchImpl();
+ if (identity != null)
{
- results = identityStore.resolveRelationships(invocationCtx,
- identity, relationshipType, parent, named, name);
+ search.setIoName(identity.getName());
+ search.setIoType(identity.getIdentityType().getName());
+ }
+ if (relationshipType != null)
+ {
+ search.setRelationshipType(relationshipType.getName());
+ }
+ search.setParent(parent);
+ search.setNamed(named);
+ search.setName(name);
- cacheSupport.putRelationshipSearchIntoCache(identity, relationshipType, parent, named, name, results);
+ Set<IdentityObjectRelationship> results = cacheSupport.getIdentityObjectRelationshipSearch(getCacheNS(invocationCtx), search);
+
+ if (results != null)
+ {
+ return results;
}
+ results = identityStore.resolveRelationships(invocationCtx,
+ identity, relationshipType, parent, named, name);
+
+ cacheSupport.putIdentityObjectRelationshipSearch(getCacheNS(invocationCtx), search, results);
+
+
return results;
}
@@ -329,7 +414,9 @@
String name) throws IdentityException, OperationNotSupportedException
{
- cacheSupport.invalidateRelationshipNameSearches(name);
+ cacheSupport.invalidateIdentityObjectRelationshipNameSearches(getCacheNS(ctx));
+ cacheSupport.invalidateIdentityObjectRelationshipSearches(getCacheNS(ctx));
+ cacheSupport.invalidateIdentityObjectSearches(getCacheNS(ctx));
return identityStore.createRelationshipName(ctx, name);
}
@@ -337,7 +424,10 @@
public String removeRelationshipName(IdentityStoreInvocationContext ctx,
String name) throws IdentityException, OperationNotSupportedException
{
- cacheSupport.invalidateRelationshipNameSearches(name);
+ cacheSupport.invalidateIdentityObjectRelationshipNameSearches(getCacheNS(ctx));
+ cacheSupport.invalidateIdentityObjectRelationshipSearches(getCacheNS(ctx));
+ cacheSupport.invalidateIdentityObjectSearches(getCacheNS(ctx));
+ cacheSupport.invalidateRelationshipNameProperties(getCacheNS(ctx), name);
return identityStore.removeRelationshipName(ctx, name);
}
@@ -345,15 +435,21 @@
public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx,
IdentityObjectSearchCriteria criteria) throws IdentityException, OperationNotSupportedException
{
- Set<String> results = cacheSupport.getRelationshipNamesSearchFromCache(criteria);
- if (results == null)
+ IdentityObjectRelationshipNameSearchImpl search = new IdentityObjectRelationshipNameSearchImpl();
+ search.setIdentityObjectSearchCriteria(criteria);
+
+ Set<String> results = cacheSupport.getIdentityObjectRelationshipNameSearch(getCacheNS(ctx), search);
+
+ if (results != null)
{
- results = identityStore.getRelationshipNames(ctx, criteria);
-
- cacheSupport.putRelationshipNamesSearchIntoCache(criteria, results);
+ return results;
}
+ results = identityStore.getRelationshipNames(ctx, criteria);
+
+ cacheSupport.putIdentityObjectRelationshipNameSearch(getCacheNS(ctx), search, results);
+
return results;
}
@@ -363,56 +459,96 @@
IdentityObjectSearchCriteria criteria) throws IdentityException, OperationNotSupportedException
{
+ IdentityObjectRelationshipNameSearchImpl search = new IdentityObjectRelationshipNameSearchImpl();
+ if (identity != null)
+ {
+ search.setIoName(identity.getName());
+ search.setIoType(identity.getIdentityType().getName());
+ }
+ search.setIdentityObjectSearchCriteria(criteria);
- Set<String> results = cacheSupport.getRelationshipNamesSearchFromCache(identity, criteria);
+ Set<String> results = cacheSupport.getIdentityObjectRelationshipNameSearch(getCacheNS(ctx), search);
- if (results == null)
+ if (results != null)
{
- results = identityStore.getRelationshipNames(ctx, identity, criteria);
-
- cacheSupport.putRelationshipNamesSearchIntoCache(identity, criteria, results);
+ return results;
}
+ results = identityStore.getRelationshipNames(ctx, identity, criteria);
+
+ cacheSupport.putIdentityObjectRelationshipNameSearch(getCacheNS(ctx), search, results);
+
return results;
}
public Map<String, String> getRelationshipNameProperties(IdentityStoreInvocationContext ctx, String name) throws IdentityException, OperationNotSupportedException
{
- //TODO: apply caching
- return identityStore.getRelationshipNameProperties(ctx, name);
+ Map<String, String> properties = cacheSupport.getProperties(getCacheNS(ctx), name);
+
+ if (properties != null)
+ {
+ return properties;
+ }
+
+ properties = identityStore.getRelationshipNameProperties(ctx, name);
+
+ cacheSupport.putProperties(getCacheNS(ctx), name, properties);
+
+ return properties;
+
}
public void setRelationshipNameProperties(IdentityStoreInvocationContext ctx, String name, Map<String, String> properties) throws IdentityException, OperationNotSupportedException
{
- //TODO: apply caching
+
identityStore.setRelationshipNameProperties(ctx, name, properties);
+
+ cacheSupport.invalidateRelationshipNameProperties(getCacheNS(ctx), name);
+ cacheSupport.putProperties(getCacheNS(ctx), name, getRelationshipNameProperties(ctx, name));
}
public void removeRelationshipNameProperties(IdentityStoreInvocationContext ctx, String name, Set<String> properties) throws IdentityException, OperationNotSupportedException
{
- //TODO: apply caching
identityStore.removeRelationshipNameProperties(ctx, name, properties);
+ cacheSupport.invalidateRelationshipNameProperties(getCacheNS(ctx), name);
+ cacheSupport.putProperties(getCacheNS(ctx), name, getRelationshipNameProperties(ctx, name));
+
}
public Map<String, String> getRelationshipProperties(IdentityStoreInvocationContext ctx, IdentityObjectRelationship relationship) throws IdentityException, OperationNotSupportedException
{
- //TODO: apply caching
- return identityStore.getRelationshipProperties(ctx, relationship);
+ Map<String, String> properties = cacheSupport.getProperties(getCacheNS(ctx), relationship);
+
+ if (properties != null)
+ {
+ return properties;
+ }
+
+ properties = identityStore.getRelationshipProperties(ctx, relationship);
+
+ cacheSupport.putProperties(getCacheNS(ctx), relationship, properties);
+
+ return properties;
+
}
public void setRelationshipProperties(IdentityStoreInvocationContext ctx, IdentityObjectRelationship relationship, Map<String, String> properties) throws IdentityException, OperationNotSupportedException
{
- //TODO: apply caching
identityStore.setRelationshipProperties(ctx, relationship, properties);
+
+ cacheSupport.invalidateRelationshipProperties(getCacheNS(ctx), relationship);
+ cacheSupport.putProperties(getCacheNS(ctx), relationship, getRelationshipProperties(ctx, relationship));
}
public void removeRelationshipProperties(IdentityStoreInvocationContext ctx, IdentityObjectRelationship relationship, Set<String> properties) throws IdentityException, OperationNotSupportedException
{
- //TODO: apply caching
identityStore.removeRelationshipProperties(ctx, relationship, properties);
+
+ cacheSupport.invalidateRelationshipProperties(getCacheNS(ctx), relationship);
+ cacheSupport.putProperties(getCacheNS(ctx), relationship, getRelationshipProperties(ctx, relationship));
}
public boolean validateCredential(IdentityStoreInvocationContext ctx,
@@ -431,11 +567,10 @@
identityStore.updateCredential(ctx, identityObject, credential);
}
-
-
@Override
public String toString()
{
return "JBossCacheIdentityStoreWrapper (IdentityStore=" + identityStore.getId() + ")";
}
+
}
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/configuration/IdentityConfigurationImpl.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/configuration/IdentityConfigurationImpl.java 2009-11-05 12:19:23 UTC (rev 906)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/configuration/IdentityConfigurationImpl.java 2009-11-05 19:23:37 UTC (rev 907)
@@ -253,6 +253,7 @@
Map<String, String> cacheProps = new HashMap<String, String>();
String cacheClassName = null;
+ String cacheRegistryName = null;
// Parse all 'cache.' prefixed options
for (String key : metaData.getOptions().keySet())
@@ -267,11 +268,29 @@
{
cacheClassName = metaData.getOptions().get(key).get(0);
}
+
+ if (key.equals("cache.providerRegistryName") && metaData.getOptions().get(key).size() > 0)
+ {
+ cacheRegistryName = metaData.getOptions().get(key).get(0);
+ }
}
}
APICacheProvider provider = null;
+ if (cacheRegistryName != null)
+ {
+ try
+ {
+ provider = (APICacheProvider)configurationContext.getConfigurationRegistry().getObject(cacheRegistryName);
+ }
+ catch (Exception e)
+ {
+ throw new IdentityException("Cannot find APICacheProvider in ConfigurationRegistry using provided name:" + cacheRegistryName, e);
+ }
+
+ }
+
// Instantiate provider
if (cacheClassName != null)
{
@@ -289,13 +308,13 @@
provider = (APICacheProvider)ct.newInstance();
- provider.initialize(cacheProps);
+ provider.initialize(cacheProps, (IdentityConfigurationRegistry)configurationContext.getConfigurationRegistry());
}
//IdentitySession session = new IdentitySessionImpl(realmName, repo, mapper);
IdentitySessionConfigurationContext sessionConfigCtx =
- new IdentitySessionConfigurationContext(realmName, configMD, repo, mapper, provider);
+ new IdentitySessionConfigurationContext(realmName, configMD, repo, mapper, provider, configurationContext, metaData.getOptions());
sessionCtxMap.put(realmName, sessionConfigCtx);
}
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/configuration/IdentitySessionConfigurationContext.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/configuration/IdentitySessionConfigurationContext.java 2009-11-05 12:19:23 UTC (rev 906)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/configuration/IdentitySessionConfigurationContext.java 2009-11-05 19:23:37 UTC (rev 907)
@@ -23,9 +23,12 @@
package org.jboss.identity.idm.impl.configuration;
import java.io.Serializable;
+import java.util.List;
+import java.util.Map;
import org.jboss.identity.idm.spi.repository.IdentityStoreRepository;
import org.jboss.identity.idm.spi.configuration.metadata.IdentityConfigurationMetaData;
+import org.jboss.identity.idm.spi.configuration.IdentityConfigurationContext;
import org.jboss.identity.idm.impl.api.session.mapper.IdentityObjectTypeMapper;
import org.jboss.identity.idm.cache.APICacheProvider;
@@ -39,22 +42,28 @@
private static final long serialVersionUID = 3263619777028197717L;
private final String realmName;
+ private final IdentityConfigurationContext identityConfigurationContext;
private final IdentityConfigurationMetaData identityConfigurationMetaData;
private final IdentityStoreRepository repository;
private final IdentityObjectTypeMapper typeMapper;
private final APICacheProvider apiCacheProvider;
+ private final Map<String, List<String>> realmOptions;
public IdentitySessionConfigurationContext(String realmName,
IdentityConfigurationMetaData identityConfigurationMetaData,
IdentityStoreRepository repository,
IdentityObjectTypeMapper typeMapper,
- APICacheProvider apiCacheProvider)
+ APICacheProvider apiCacheProvider,
+ IdentityConfigurationContext identityConfigurationContext,
+ Map<String, List<String>> realmOptions)
{
this.realmName = realmName;
this.identityConfigurationMetaData = identityConfigurationMetaData;
this.repository = repository;
this.typeMapper = typeMapper;
this.apiCacheProvider = apiCacheProvider;
+ this.identityConfigurationContext = identityConfigurationContext;
+ this.realmOptions = realmOptions;
}
public String getRealmName()
@@ -81,4 +90,14 @@
{
return apiCacheProvider;
}
+
+ public IdentityConfigurationContext getIdentityConfigurationContext()
+ {
+ return identityConfigurationContext;
+ }
+
+ public Map<String, List<String>> getRealmOptions()
+ {
+ return realmOptions;
+ }
}
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/repository/AbstractIdentityStoreRepository.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/repository/AbstractIdentityStoreRepository.java 2009-11-05 12:19:23 UTC (rev 906)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/repository/AbstractIdentityStoreRepository.java 2009-11-05 19:23:37 UTC (rev 907)
@@ -64,10 +64,14 @@
public static final String CACHE_OPTION = "cache";
- public static final String CACHE_CONFIG_FILE_OPTION = "cache.config-file";
+ public static final String CACHE_CONFIG_FILE_OPTION = "cache.configFile";
- public static final String CACHE_PROVIDER_CLASS_OPTION = "cache.provider.class";
+ public static final String CACHE_PROVIDER_CLASS_OPTION = "cache.providerClass";
+ public static final String CACHE_PROVIDER_REGISTRY_NAME = "cache.providerRegistryName";
+
+ public static final String CACHE_SCOPE = "cache.scope";
+
public static final String ALLOW_NOT_DEFINED_IDENTITY_OBJECT_TYPES_OPTION = "allowNotDefinedIdentityObjectTypes";
private boolean allowNotDefinedIdentityObjectTypes = false;
@@ -106,55 +110,67 @@
if (cacheOption != null && cacheOption.equalsIgnoreCase("true"))
{
- String cacheConfig = configurationMD.getOptionSingleValue(CACHE_CONFIG_FILE_OPTION);
String cacheSupportClass = configurationMD.getOptionSingleValue(CACHE_PROVIDER_CLASS_OPTION);
+ String cacheRegistryName = configurationMD.getOptionSingleValue(CACHE_PROVIDER_REGISTRY_NAME);
+ String cacheScope = configurationMD.getOptionSingleValue(CACHE_PROVIDER_REGISTRY_NAME);
- if (cacheConfig == null)
+ if (cacheSupportClass == null && cacheRegistryName == null)
{
- throw new IdentityException(CACHE_CONFIG_FILE_OPTION + " is missing in the repository configuration");
+ throw new IdentityException(CACHE_PROVIDER_CLASS_OPTION + " is missing in the repository configuration");
}
- if (cacheSupportClass == null)
+ IdentityStoreCacheProvider cacheSupport = null;
+
+ Map<String, String> cacheProps = new HashMap<String, String>();
+
+ // Parse all 'cache.' prefixed options
+ for (String key : configurationMD.getOptions().keySet())
{
- throw new IdentityException(CACHE_PROVIDER_CLASS_OPTION + " is missing in the repository configuration");
+ if (key.startsWith("cache."))
+ {
+ if (configurationMD.getOptions().get(key).size() > 0)
+ {
+ cacheProps.put(key, configurationMD.getOptions().get(key).get(0));
+ }
+ }
}
- ClassLoader classLoader = SecurityActions.getContextClassLoader();
- InputStream cacheConfigInputStream = classLoader.getResourceAsStream(cacheConfig);
- if (cacheConfigInputStream == null)
+ if (cacheRegistryName != null)
{
- throw new IdentityException("JBoss Cache config file specified in option \"" + CACHE_CONFIG_FILE_OPTION +
- "\" doesn't exist: " + cacheConfig);
+ try
+ {
+ cacheSupport = (IdentityStoreCacheProvider)configurationContext.getConfigurationRegistry().getObject(cacheRegistryName);
+ }
+ catch (IdentityException e)
+ {
+ throw new IdentityException("Cannot find IdentityStoreCacheProvider cache provider instance" +
+ "with provided name:" + cacheRegistryName, e);
+ }
}
-
-
-
- try
+ else
{
- Class cacheClass = null;
- cacheClass = Class.forName(cacheSupportClass);
+ try
+ {
+ Class cacheClass = null;
+ cacheClass = Class.forName(cacheSupportClass);
- Class partypes[] = new Class[1];
- partypes[0] = InputStream.class;
+ Constructor ct = cacheClass.getConstructor();
- Constructor ct = cacheClass.getConstructor(partypes);
- Object argList[] = new Object[1];
- argList[0] = cacheConfigInputStream;
+ cacheSupport = (IdentityStoreCacheProvider)ct.newInstance();
+ cacheSupport.initialize(cacheProps, configurationContext);
- IdentityStoreCacheProvider cacheSupport = (IdentityStoreCacheProvider)ct.newInstance(argList);
+ }
+ catch (Exception e)
+ {
+ throw new IdentityException("Cannot instantiate cache provider:" + cacheSupportClass, e);
+ }
+ }
- defaultIdentityStore = new JBossCacheIdentityStoreWrapper(defaultIdentityStore, cacheSupport);
+ defaultIdentityStore = new JBossCacheIdentityStoreWrapper(defaultIdentityStore, cacheSupport, cacheScope);
- }
- catch (Exception e)
- {
- throw new IdentityException("Cannot instantiate cache provider:" + cacheSupportClass, e);
- }
-
-
}
}
@@ -170,52 +186,67 @@
if (cacheOption != null && cacheOption.equalsIgnoreCase("true"))
{
- String cacheConfig = identityStoreMappingMetaData.getOptionSingleValue(CACHE_CONFIG_FILE_OPTION);
+
String cacheSupportClass = identityStoreMappingMetaData.getOptionSingleValue(CACHE_PROVIDER_CLASS_OPTION);
+ String cacheRegistryName = identityStoreMappingMetaData.getOptionSingleValue(CACHE_PROVIDER_REGISTRY_NAME);
+ String cacheScope = identityStoreMappingMetaData.getOptionSingleValue(CACHE_PROVIDER_REGISTRY_NAME);
-
- if (cacheConfig == null)
+ if (cacheSupportClass == null && cacheRegistryName == null)
{
- throw new IdentityException(CACHE_CONFIG_FILE_OPTION + " is missing in the repository identity-store-mapping configuration");
+ throw new IdentityException(CACHE_PROVIDER_CLASS_OPTION + " is missing in the <identity-store><options> configuration");
}
- if (cacheSupportClass == null)
+ IdentityStoreCacheProvider cacheSupport = null;
+
+ Map<String, String> cacheProps = new HashMap<String, String>();
+
+ // Parse all 'cache.' prefixed options
+ for (String key : identityStoreMappingMetaData.getOptions().keySet())
{
- throw new IdentityException(CACHE_PROVIDER_CLASS_OPTION + " is missing in the repository configuration");
+ if (key.startsWith("cache."))
+ {
+ if (identityStoreMappingMetaData.getOptions().get(key).size() > 0)
+ {
+ cacheProps.put(key, identityStoreMappingMetaData.getOptions().get(key).get(0));
+ }
+ }
}
- ClassLoader classLoader = SecurityActions.getContextClassLoader();
- InputStream cacheConfigInputStream = classLoader.getResourceAsStream(cacheConfig);
- if (cacheConfigInputStream == null)
+ if (cacheRegistryName != null)
{
- throw new IdentityException("JBoss Cache config file specified in option \"" + CACHE_CONFIG_FILE_OPTION +
- "\" doesn't exist: " + cacheConfig);
+ try
+ {
+ cacheSupport = (IdentityStoreCacheProvider)configurationContext.getConfigurationRegistry().getObject(cacheRegistryName);
+ }
+ catch (IdentityException e)
+ {
+ throw new IdentityException("Cannot find IdentityStoreCacheProvider cache provider instance" +
+ "with provided name:" + cacheRegistryName, e);
+ }
}
-
- try
+ else
{
- Class cacheClass = null;
- cacheClass = Class.forName(cacheSupportClass);
+ try
+ {
+ Class cacheClass = null;
+ cacheClass = Class.forName(cacheSupportClass);
- Class partypes[] = new Class[1];
- partypes[0] = InputStream.class;
+ Constructor ct = cacheClass.getConstructor();
- Constructor ct = cacheClass.getConstructor(partypes);
- Object argList[] = new Object[1];
- argList[0] = cacheConfigInputStream;
+ cacheSupport = (IdentityStoreCacheProvider)ct.newInstance();
+ cacheSupport.initialize(cacheProps, configurationContext);
- IdentityStoreCacheProvider cacheSupport = (IdentityStoreCacheProvider)ct.newInstance(argList);
+ }
+ catch (Exception e)
+ {
+ throw new IdentityException("Cannot instantiate cache provider:" + cacheSupportClass, e);
+ }
+ }
- store = new JBossCacheIdentityStoreWrapper(store, cacheSupport);
- }
- catch (Exception e)
- {
- throw new IdentityException("Cannot instantiate cache provider:" + cacheSupportClass, e);
- }
+ store = new JBossCacheIdentityStoreWrapper(store, cacheSupport, cacheScope);
-
}
if (store == null)
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/repository/FallbackIdentityStoreRepository.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/repository/FallbackIdentityStoreRepository.java 2009-11-05 12:19:23 UTC (rev 906)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/repository/FallbackIdentityStoreRepository.java 2009-11-05 19:23:37 UTC (rev 907)
@@ -374,7 +374,7 @@
RepositoryIdentityStoreSessionImpl repoSession = (RepositoryIdentityStoreSessionImpl)invocationCtx.getIdentityStoreSession();
IdentityStoreSession targetSession = repoSession.getIdentityStoreSession(id);
- return new SimpleIdentityStoreInvocationContext(targetSession, invocationCtx.getRealmId());
+ return new SimpleIdentityStoreInvocationContext(targetSession, invocationCtx.getRealmId(), String.valueOf(this.hashCode()));
}
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/repository/WrapperIdentityStoreRepository.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/repository/WrapperIdentityStoreRepository.java 2009-11-05 12:19:23 UTC (rev 906)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/repository/WrapperIdentityStoreRepository.java 2009-11-05 19:23:37 UTC (rev 907)
@@ -107,7 +107,7 @@
RepositoryIdentityStoreSessionImpl repoSession = (RepositoryIdentityStoreSessionImpl)invocationCtx.getIdentityStoreSession();
IdentityStoreSession targetSession = repoSession.getIdentityStoreSession(id);
- return new SimpleIdentityStoreInvocationContext(targetSession, invocationCtx.getRealmId());
+ return new SimpleIdentityStoreInvocationContext(targetSession, invocationCtx.getRealmId(), String.valueOf(this.hashCode()));
}
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/store/SimpleIdentityStoreInvocationContext.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/store/SimpleIdentityStoreInvocationContext.java 2009-11-05 12:19:23 UTC (rev 906)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/store/SimpleIdentityStoreInvocationContext.java 2009-11-05 19:23:37 UTC (rev 907)
@@ -35,7 +35,9 @@
private final String realmId;
- public SimpleIdentityStoreInvocationContext(IdentityStoreSession identityStoreSession, String realmId)
+ private final String sessionId;
+
+ public SimpleIdentityStoreInvocationContext(IdentityStoreSession identityStoreSession, String realmId, String sessionId)
{
if (identityStoreSession == null)
{
@@ -44,6 +46,7 @@
this.identityStoreSession = identityStoreSession;
this.realmId = realmId;
+ this.sessionId = sessionId;
}
public IdentityStoreSession getIdentityStoreSession()
@@ -55,4 +58,9 @@
{
return realmId;
}
+
+ public String getSessionId()
+ {
+ return sessionId;
+ }
}
Added: idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/cache/IdentityObjectRelationshipNameSearch.java
===================================================================
--- idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/cache/IdentityObjectRelationshipNameSearch.java (rev 0)
+++ idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/cache/IdentityObjectRelationshipNameSearch.java 2009-11-05 19:23:37 UTC (rev 907)
@@ -0,0 +1,28 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2009, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* 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.identity.idm.spi.cache;
+
+public interface IdentityObjectRelationshipNameSearch extends Search
+{
+}
Added: idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/cache/IdentityObjectRelationshipSearch.java
===================================================================
--- idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/cache/IdentityObjectRelationshipSearch.java (rev 0)
+++ idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/cache/IdentityObjectRelationshipSearch.java 2009-11-05 19:23:37 UTC (rev 907)
@@ -0,0 +1,28 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2009, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* 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.identity.idm.spi.cache;
+
+public interface IdentityObjectRelationshipSearch extends Search
+{
+}
Added: idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/cache/IdentityObjectSearch.java
===================================================================
--- idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/cache/IdentityObjectSearch.java (rev 0)
+++ idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/cache/IdentityObjectSearch.java 2009-11-05 19:23:37 UTC (rev 907)
@@ -0,0 +1,28 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2009, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* 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.identity.idm.spi.cache;
+
+public interface IdentityObjectSearch extends Search
+{
+}
Modified: idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/cache/IdentityStoreCacheProvider.java
===================================================================
--- idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/cache/IdentityStoreCacheProvider.java 2009-11-05 12:19:23 UTC (rev 906)
+++ idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/cache/IdentityStoreCacheProvider.java 2009-11-05 19:23:37 UTC (rev 907)
@@ -28,97 +28,113 @@
import org.jboss.identity.idm.spi.model.IdentityObjectRelationshipType;
import org.jboss.identity.idm.spi.model.IdentityObjectRelationship;
import org.jboss.identity.idm.spi.search.IdentityObjectSearchCriteria;
+import org.jboss.identity.idm.spi.configuration.IdentityRepositoryConfigurationContext;
import java.util.Map;
import java.util.Collection;
import java.util.Set;
+/**
+ * Cache provider for Identity SPI. Namespaces enable flexible use (per realm or per session)
+ *
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
public interface IdentityStoreCacheProvider
{
-
- void initResidentNodes(Set<String> supportedIdentityObjectTypes,
- Set<String> supportedRelationshipTypes);
- void putIntoCache(IdentityObject io);
+ /**
+ * Initialize provider.
+ * @param properties
+ */
+ void initialize(Map<String, String> properties, IdentityRepositoryConfigurationContext configurationContext);
- void putIntoCache(IdentityObject io, Map<String, IdentityObjectAttribute> attributesMap);
- void removeFromCache(IdentityObject io);
+ /**
+ * Generate realm namespace.
+ *
+ * @param storeId - if null will generate root namespace
+ * @return
+ */
+ String getNamespace(String storeId);
- void removeAttributesFromCache(IdentityObject io);
+ /**
+ * Generate namespace based on realm and session ids.
+ *
+ * @param storeId if null will generate root namespace
+ * @param realmId if null will generate store namespace
+ * @return
+ */
+ String getNamespace(String storeId, String realmId);
- IdentityObject getFromCache(String name, IdentityObjectType identityObjectType);
+ /**
+ * Generate namespace based on realm and session ids.
+ *
+ * @param storeId if null will generate root namespace
+ * @param realmId if null will generate store namespace
+ * @param sessionId if null will generate realm namespace
+ * @return
+ */
+ String getNamespace(String storeId, String realmId, String sessionId);
- Map<String, IdentityObjectAttribute> getAttributesFromCache(String name, IdentityObjectType identityObjectType);
+ void invalidate(String ns);
- IdentityObject getFromCache(String id);
+ //
- void putIdentityObjectSearchIntoCache(IdentityObjectType identityType,
- IdentityObjectSearchCriteria criteria,
- Collection<IdentityObject> results);
+ void putIdentityObjectCount(String ns, String type, int count);
- Collection<IdentityObject> getIdentityObjectSearchFromCache(IdentityObjectType identityType,
- IdentityObjectSearchCriteria criteria);
+ int getIdentityObjectCount(String ns, String type);
- void putIdentityObjectSearchToCache(IdentityObject identity,
- IdentityObjectRelationshipType relationshipType,
- boolean parent,
- IdentityObjectSearchCriteria criteria,
- Collection<IdentityObject> results);
+ void invalidateIdentityObjectCount(String ns, String type);
- Collection<IdentityObject> getIdentityObjectSearchFromCache(IdentityObject identity,
- IdentityObjectRelationshipType relationshipType,
- boolean parent,
- IdentityObjectSearchCriteria criteria);
+ void putIdentityObjectSearch(String ns, IdentityObjectSearch search, Collection<IdentityObject> results);
- void putRelationshipsSearchIntoCache(IdentityObject fromIdentity,
- IdentityObject toIdentity,
- IdentityObjectRelationshipType relationshipType,
- Set<IdentityObjectRelationship> results);
+ Collection<IdentityObject> getIdentityObjectSearch(String ns, IdentityObjectSearch search);
- Set<IdentityObjectRelationship> getRelationshipsSearchFromCache(IdentityObject fromIdentity,
- IdentityObject toIdentity,
- IdentityObjectRelationshipType relationshipType);
+ void invalidateIdentityObjectSearches(String ns);
- void putRelationshipSearchIntoCache(IdentityObject identity,
- IdentityObjectRelationshipType relationshipType,
- boolean parent,
- boolean named,
- String name,
- Set<IdentityObjectRelationship> results);
+ //
- Set<IdentityObjectRelationship> getRelationshipsSearchFromCache(IdentityObject identity,
- IdentityObjectRelationshipType relationshipType,
- boolean parent,
- boolean named,
- String name);
+ void putIdentityObjectRelationshipSearch(String ns, IdentityObjectRelationshipSearch search, Set<IdentityObjectRelationship> results);
- void invalidateCachedIdentityObjectSearches(IdentityObject io);
+ Set<IdentityObjectRelationship> getIdentityObjectRelationshipSearch(String ns, IdentityObjectRelationshipSearch search);
- void putIdentityObjectCountIntoCache(IdentityObjectType identityType, int count);
+ void invalidateIdentityObjectRelationshipSearches(String ns);
- int getIdentityObjectCountFromCache(IdentityObjectType identityType);
+ //
- void invalidateCachedIdentityObjectCount(IdentityObjectType identityType);
+ void putIdentityObjectRelationshipNameSearch(String ns, IdentityObjectRelationshipNameSearch search, Set<String> results);
- void invalidateCachedRelationshipSearches(IdentityObject fromIdentity,
- IdentityObject toIdentity,
- IdentityObjectRelationshipType relationshipType,
- String relationshipName);
+ Set<String> getIdentityObjectRelationshipNameSearch(String ns, IdentityObjectRelationshipNameSearch search);
- void invalidateCachedRelationshipSearches(IdentityObject identity1, IdentityObject identity2, boolean named);
+ void invalidateIdentityObjectRelationshipNameSearches(String ns);
- void invalidateRelationshipNameSearches(String name);
+ //
- void putRelationshipNamesSearchIntoCache(IdentityObjectSearchCriteria criteria, Set<String> results);
+ void putProperties(String ns, IdentityObjectRelationship relationship, Map<String, String> properties);
- Set<String> getRelationshipNamesSearchFromCache(IdentityObjectSearchCriteria criteria);
+ Map<String, String> getProperties(String ns, IdentityObjectRelationship relationship);
- void putRelationshipNamesSearchIntoCache(IdentityObject identity,
- IdentityObjectSearchCriteria criteria,
- Set<String> results);
+ void invalidateRelationshipProperties(String ns, IdentityObjectRelationship relationship);
- Set<String> getRelationshipNamesSearchFromCache(IdentityObject identity, IdentityObjectSearchCriteria criteria);
+ void invalidateRelationshipProperties(String ns);
+ void putProperties(String ns, String name, Map<String, String> properties);
+ Map<String, String> getProperties(String ns, String name);
+
+ void invalidateRelationshipNameProperties(String ns, String relationship);
+
+ void invalidateRelationshipNameProperties(String ns);
+
+ //
+
+ void putIdentityObjectAttributes(String ns, IdentityObject identityObject, Map<String, IdentityObjectAttribute> attributes);
+
+ Map<String, IdentityObjectAttribute> getIdentityObjectAttributes(String ns, IdentityObject identityObject);
+
+ void invalidateIdentityObjectAttriubtes(String ns, IdentityObject identityObject);
+
+ void invalidateIdentityObjectAttriubtes(String ns);
+
}
Added: idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/cache/Search.java
===================================================================
--- idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/cache/Search.java (rev 0)
+++ idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/cache/Search.java 2009-11-05 19:23:37 UTC (rev 907)
@@ -0,0 +1,38 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2009, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* 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.identity.idm.spi.cache;
+
+import org.jboss.identity.idm.spi.search.IdentityObjectSearchCriteria;
+
+import java.io.Serializable;
+
+public abstract interface Search extends Serializable
+{
+
+ IdentityObjectSearchCriteria getIdentityObjectSearchCriteria();
+
+ void setIdentityObjectSearchCriteria(IdentityObjectSearchCriteria criteria);
+
+
+}
Modified: idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/store/IdentityStoreInvocationContext.java
===================================================================
--- idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/store/IdentityStoreInvocationContext.java 2009-11-05 12:19:23 UTC (rev 906)
+++ idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/store/IdentityStoreInvocationContext.java 2009-11-05 19:23:37 UTC (rev 907)
@@ -35,5 +35,7 @@
IdentityStoreSession getIdentityStoreSession();
String getRealmId();
+
+ String getSessionId();
}
Modified: idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreTestCase.java
===================================================================
--- idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreTestCase.java 2009-11-05 12:19:23 UTC (rev 906)
+++ idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreTestCase.java 2009-11-05 19:23:37 UTC (rev 907)
@@ -126,6 +126,11 @@
{
return "testRealm";
}
+
+ public String getSessionId()
+ {
+ return "";
+ }
};
Modified: idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/store/ldap/LDAPIdentityStoreTestCase.java
===================================================================
--- idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/store/ldap/LDAPIdentityStoreTestCase.java 2009-11-05 12:19:23 UTC (rev 906)
+++ idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/store/ldap/LDAPIdentityStoreTestCase.java 2009-11-05 19:23:37 UTC (rev 907)
@@ -114,6 +114,11 @@
{
return "testRealm";
}
+
+ public String getSessionId()
+ {
+ return "";
+ }
};
}
Modified: idm/trunk/idm-testsuite/src/test/resources/test-identity-config-msad-local.xml
===================================================================
--- idm/trunk/idm-testsuite/src/test/resources/test-identity-config-msad-local.xml 2009-11-05 12:19:23 UTC (rev 906)
+++ idm/trunk/idm-testsuite/src/test/resources/test-identity-config-msad-local.xml 2009-11-05 19:23:37 UTC (rev 907)
@@ -89,11 +89,11 @@
<value>false</value>
</option>
<option>
- <name>cache.provider.class</name>
- <value>org.jboss.identity.idm.impl.cache.IdentityStoreCacheProviderImpl</value>
+ <name>cache.providerClass</name>
+ <value>org.jboss.identity.idm.impl.cache.JBossCacheIdentityStoreCacheProviderImpl</value>
</option>
<option>
- <name>cache.config-file</name>
+ <name>cache.configFile</name>
<value>jboss-cache-config.xml</value>
</option>
</options>
@@ -140,11 +140,11 @@
<value>false</value>
</option>
<option>
- <name>cache.provider.class</name>
- <value>org.jboss.identity.idm.impl.cache.IdentityStoreCacheProviderImpl</value>
+ <name>cache.providerClass</name>
+ <value>org.jboss.identity.idm.impl.cache.JBossCacheIdentityStoreCacheProviderImpl</value>
</option>
<option>
- <name>cache.config-file</name>
+ <name>cache.configFile</name>
<value>jboss-cache-config.xml</value>
</option>
</options>
Modified: idm/trunk/idm-testsuite/src/test/resources/test-identity-config-msad.xml
===================================================================
--- idm/trunk/idm-testsuite/src/test/resources/test-identity-config-msad.xml 2009-11-05 12:19:23 UTC (rev 906)
+++ idm/trunk/idm-testsuite/src/test/resources/test-identity-config-msad.xml 2009-11-05 19:23:37 UTC (rev 907)
@@ -89,11 +89,11 @@
<value>false</value>
</option>
<option>
- <name>cache.provider.class</name>
- <value>org.jboss.identity.idm.impl.cache.IdentityStoreCacheProviderImpl</value>
+ <name>cache.providerClass</name>
+ <value>org.jboss.identity.idm.impl.cache.JBossCacheIdentityStoreCacheProviderImpl</value>
</option>
<option>
- <name>cache.config-file</name>
+ <name>cache.configFile</name>
<value>jboss-cache-config.xml</value>
</option>
</options>
@@ -140,11 +140,11 @@
<value>false</value>
</option>
<option>
- <name>cache.provider.class</name>
- <value>org.jboss.identity.idm.impl.cache.IdentityStoreCacheProviderImpl</value>
+ <name>cache.providerClass</name>
+ <value>org.jboss.identity.idm.impl.cache.JBossCacheIdentityStoreCacheProviderImpl</value>
</option>
<option>
- <name>cache.config-file</name>
+ <name>cache.configFile</name>
<value>jboss-cache-config.xml</value>
</option>
</options>
Modified: idm/trunk/idm-testsuite/src/test/resources/test-identity-config-openldapds.xml
===================================================================
--- idm/trunk/idm-testsuite/src/test/resources/test-identity-config-openldapds.xml 2009-11-05 12:19:23 UTC (rev 906)
+++ idm/trunk/idm-testsuite/src/test/resources/test-identity-config-openldapds.xml 2009-11-05 19:23:37 UTC (rev 907)
@@ -89,11 +89,11 @@
<value>false</value>
</option>
<option>
- <name>cache.provider.class</name>
- <value>org.jboss.identity.idm.impl.cache.IdentityStoreCacheProviderImpl</value>
+ <name>cache.providerClass</name>
+ <value>org.jboss.identity.idm.impl.cache.JBossCacheIdentityStoreCacheProviderImpl</value>
</option>
<option>
- <name>cache.config-file</name>
+ <name>cache.configFile</name>
<value>jboss-cache-config.xml</value>
</option>
</options>
@@ -140,11 +140,11 @@
<value>false</value>
</option>
<option>
- <name>cache.provider.class</name>
- <value>org.jboss.identity.idm.impl.cache.IdentityStoreCacheProviderImpl</value>
+ <name>cache.providerClass</name>
+ <value>org.jboss.identity.idm.impl.cache.JBossCacheIdentityStoreCacheProviderImpl</value>
</option>
<option>
- <name>cache.config-file</name>
+ <name>cache.configFile</name>
<value>jboss-cache-config.xml</value>
</option>
</options>
Modified: idm/trunk/idm-testsuite/src/test/resources/test-identity-config-redhatds.xml
===================================================================
--- idm/trunk/idm-testsuite/src/test/resources/test-identity-config-redhatds.xml 2009-11-05 12:19:23 UTC (rev 906)
+++ idm/trunk/idm-testsuite/src/test/resources/test-identity-config-redhatds.xml 2009-11-05 19:23:37 UTC (rev 907)
@@ -89,11 +89,11 @@
<value>false</value>
</option>
<option>
- <name>cache.provider.class</name>
- <value>org.jboss.identity.idm.impl.cache.IdentityStoreCacheProviderImpl</value>
+ <name>cache.providerClass</name>
+ <value>org.jboss.identity.idm.impl.cache.JBossCacheIdentityStoreCacheProviderImpl</value>
</option>
<option>
- <name>cache.config-file</name>
+ <name>cache.configFile</name>
<value>jboss-cache-config.xml</value>
</option>
</options>
@@ -140,11 +140,11 @@
<value>false</value>
</option>
<option>
- <name>cache.provider.class</name>
- <value>org.jboss.identity.idm.impl.cache.IdentityStoreCacheProviderImpl</value>
+ <name>cache.providerClass</name>
+ <value>org.jboss.identity.idm.impl.cache.JBossCacheIdentityStoreCacheProviderImpl</value>
</option>
<option>
- <name>cache.config-file</name>
+ <name>cache.configFile</name>
<value>jboss-cache-config.xml</value>
</option>
</options>
Modified: idm/trunk/idm-testsuite/src/test/resources/test-identity-config-sunds.xml
===================================================================
--- idm/trunk/idm-testsuite/src/test/resources/test-identity-config-sunds.xml 2009-11-05 12:19:23 UTC (rev 906)
+++ idm/trunk/idm-testsuite/src/test/resources/test-identity-config-sunds.xml 2009-11-05 19:23:37 UTC (rev 907)
@@ -89,11 +89,11 @@
<value>false</value>
</option>
<option>
- <name>cache.provider.class</name>
- <value>org.jboss.identity.idm.impl.cache.IdentityStoreCacheProviderImpl</value>
+ <name>cache.providerClass</name>
+ <value>org.jboss.identity.idm.impl.cache.JBossCacheIdentityStoreCacheProviderImpl</value>
</option>
<option>
- <name>cache.config-file</name>
+ <name>cache.configFile</name>
<value>jboss-cache-config.xml</value>
</option>
</options>
@@ -140,11 +140,11 @@
<value>false</value>
</option>
<option>
- <name>cache.provider.class</name>
- <value>org.jboss.identity.idm.impl.cache.IdentityStoreCacheProviderImpl</value>
+ <name>cache.providerClass</name>
+ <value>org.jboss.identity.idm.impl.cache.JBossCacheIdentityStoreCacheProviderImpl</value>
</option>
<option>
- <name>cache.config-file</name>
+ <name>cache.configFile</name>
<value>jboss-cache-config.xml</value>
</option>
</options>
Modified: idm/trunk/idm-testsuite/src/test/resources/test-identity-config.xml
===================================================================
--- idm/trunk/idm-testsuite/src/test/resources/test-identity-config.xml 2009-11-05 12:19:23 UTC (rev 906)
+++ idm/trunk/idm-testsuite/src/test/resources/test-identity-config.xml 2009-11-05 19:23:37 UTC (rev 907)
@@ -126,15 +126,15 @@
<options>
<option>
<name>cache</name>
- <value>false</value>
+ <value>true</value>
</option>
<option>
- <name>cache.provider.class</name>
- <value>org.jboss.identity.idm.impl.cache.IdentityStoreCacheProviderImpl</value>
+ <name>cache.providerClass</name>
+ <value>org.jboss.identity.idm.impl.cache.JBossCacheIdentityStoreCacheProviderImpl</value>
</option>
<option>
- <name>cache.config-file</name>
- <value>jboss-cache-config.xml</value>
+ <name>cache.configFile</name>
+ <value>jboss-cache.xml</value>
</option>
</options>
</identity-store-mapping>
@@ -177,15 +177,15 @@
<options>
<option>
<name>cache</name>
- <value>false</value>
+ <value>true</value>
</option>
<option>
- <name>cache.provider.class</name>
- <value>org.jboss.identity.idm.impl.cache.IdentityStoreCacheProviderImpl</value>
+ <name>cache.providerClass</name>
+ <value>org.jboss.identity.idm.impl.cache.JBossCacheIdentityStoreCacheProviderImpl</value>
</option>
<option>
- <name>cache.config-file</name>
- <value>jboss-cache-config.xml</value>
+ <name>cache.configFile</name>
+ <value>jboss-cache.xml</value>
</option>
</options>
</identity-store-mapping>
16 years, 6 months
JBoss Identity SVN: r906 - in idm/trunk: idm-cache/src/main/java/org/jboss/identity/idm/impl/cache and 3 other directories.
by jboss-identity-commits@lists.jboss.org
Author: bdaw
Date: 2009-11-05 07:19:23 -0500 (Thu, 05 Nov 2009)
New Revision: 906
Modified:
idm/trunk/idm-cache/pom.xml
idm/trunk/idm-cache/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheAPICacheProviderImpl.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/IdentitySessionFactoryImpl.java
idm/trunk/idm-testsuite/pom.xml
idm/trunk/parent/logging.properties
Log:
- fix for some logging
Modified: idm/trunk/idm-cache/pom.xml
===================================================================
--- idm/trunk/idm-cache/pom.xml 2009-11-04 22:30:01 UTC (rev 905)
+++ idm/trunk/idm-cache/pom.xml 2009-11-05 12:19:23 UTC (rev 906)
@@ -57,6 +57,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>2.4.3</version>
<configuration>
+ <useFile>true</useFile>
<systemProperties>
<property>
<name>dataSourceName</name>
@@ -66,6 +67,10 @@
<name>directoryName</name>
<value>${directoryName}</value>
</property>
+ <property>
+ <name>java.util.logging.config.file</name>
+ <value>../parent/logging.properties</value>
+ </property>
</systemProperties>
</configuration>
</plugin>
Modified: idm/trunk/idm-cache/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheAPICacheProviderImpl.java
===================================================================
--- idm/trunk/idm-cache/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheAPICacheProviderImpl.java 2009-11-04 22:30:01 UTC (rev 905)
+++ idm/trunk/idm-cache/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheAPICacheProviderImpl.java 2009-11-05 12:19:23 UTC (rev 906)
@@ -138,6 +138,10 @@
public void invalidate(String ns)
{
cache.getRoot().removeChild(getNamespacedFqn(ns));
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Invalidating namespace:" + ns);
+ }
}
public String getNamespace(String realmId)
@@ -175,7 +179,7 @@
{
User user = (User)node.get(NODE_OBJECT_KEY);
- if (log.isLoggable(Level.FINER))
+ if (log.isLoggable(Level.FINER) && user != null)
{
log.finer(this.toString() + "User found in cache: id=" + user.getId());
}
@@ -223,7 +227,7 @@
{
Collection<User> users = (Collection<User>)node.get(NODE_OBJECT_KEY);
- if (log.isLoggable(Level.FINER))
+ if (log.isLoggable(Level.FINER) && users != null)
{
log.finer(this.toString() + "User criteria search found in cache: users.size()=" + users.size() +
"; criteria.hash()=" + criteria.hashCode());
@@ -241,6 +245,11 @@
getCache().getRoot().removeChild(Fqn.fromElements(getNamespacedFqn(ns), NODE_USERS_COUNT));
getCache().getRoot().removeChild(Fqn.fromElements(getNamespacedFqn(ns), NODE_USERS_CRITERIA));
getCache().getRoot().removeChild(Fqn.fromElements(getNamespacedFqn(ns), NODE_USERS_QUERIES));
+ getCache().getRoot().removeChild(Fqn.fromElements(getNamespacedFqn(ns), NODE_USERS_SEARCHES));
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Invalidating Users cache. Namespace:" + ns);
+ }
}
public void putUserCount(String ns, int count)
@@ -272,7 +281,7 @@
count = i.intValue();
}
- if (log.isLoggable(Level.FINER))
+ if (log.isLoggable(Level.FINER) && count != -1)
{
log.finer(this.toString() + "User count found in cache: " + count);
}
@@ -286,6 +295,10 @@
public void invalidateUserCount(String ns)
{
getCache().getRoot().removeChild(Fqn.fromElements(getNamespacedFqn(ns), NODE_USERS_COUNT));
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Invalidating User count. Namespace:" + ns);
+ }
}
public void putGroup(String ns, Group group)
@@ -312,7 +325,7 @@
{
Group group = (Group)node.get(NODE_OBJECT_KEY);
- if (log.isLoggable(Level.FINER))
+ if (log.isLoggable(Level.FINER) && group != null)
{
log.finer(this.toString() + "Group found in cache: id=" + group.getId());
}
@@ -360,7 +373,7 @@
{
Collection<Group> groups = (Collection<Group>)node.get(NODE_OBJECT_KEY);
- if (log.isLoggable(Level.FINER))
+ if (log.isLoggable(Level.FINER) && groups != null)
{
log.finer(this.toString() + "Group criteria search found in cache: groups.size()=" + groups.size() +
"; criteria.hash()=" + criteria.hashCode());
@@ -378,6 +391,11 @@
getCache().getRoot().removeChild(Fqn.fromElements(getNamespacedFqn(ns), NODE_GROUPS_COUNT));
getCache().getRoot().removeChild(Fqn.fromElements(getNamespacedFqn(ns), NODE_GROUPS_CRITERIA));
getCache().getRoot().removeChild(Fqn.fromElements(getNamespacedFqn(ns), NODE_GROUPS_QUERIES));
+ getCache().getRoot().removeChild(Fqn.fromElements(getNamespacedFqn(ns), NODE_GROUPS_SEARCHES));
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Invalidating Groups cache. Namespace:" + ns);
+ }
}
public void putGroupCount(String ns, String groupType, int count)
@@ -409,7 +427,7 @@
count = i.intValue();
}
- if (log.isLoggable(Level.FINER))
+ if (log.isLoggable(Level.FINER) && count != -1)
{
log.finer(this.toString() + "Group count found in cache: groupType=" + groupType + "; count=" + count);
}
@@ -423,6 +441,10 @@
public void invalidateGroupCount(String ns, String groupType)
{
cache.getRoot().removeChild(getFqn(ns, NODE_GROUPS_COUNT, groupType));
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Invalidating Group count. Namespace:" + ns);
+ }
}
public void putRole(String ns, Role role)
@@ -450,7 +472,7 @@
{
Role result = (Role)node.get(NODE_OBJECT_KEY);
- if (log.isLoggable(Level.FINER))
+ if (log.isLoggable(Level.FINER) && result != null)
{
log.finer(this.toString() + "Role found in cache: id=" + result);
}
@@ -491,7 +513,7 @@
{
RoleType result = (RoleType)node.get(NODE_OBJECT_KEY);
- if (log.isLoggable(Level.FINER))
+ if (log.isLoggable(Level.FINER) && result != null)
{
log.finer(this.toString() + "RoleType found in cache: name=" + role.getName());
}
@@ -531,7 +553,7 @@
{
Map<String, Attribute> attributes = (Map<String, Attribute>)node.get(NODE_OBJECT_KEY);
- if (log.isLoggable(Level.FINER))
+ if (log.isLoggable(Level.FINER) && attributes != null)
{
log.finer(this.toString() + "Attributes search found in cache: attributes.size()=" + attributes.size() +
"; id=" + id);
@@ -546,11 +568,19 @@
public void invalidateAttributes(String ns, String id)
{
cache.getRoot().removeChild(getFqn(ns, NODE_ATTRIBUTES, id));
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Invalidating Attributes. id=" + id +";namespace:" + ns);
+ }
}
public void invalidateAttributes(String ns)
{
cache.getRoot().removeChild(getFqn(ns, NODE_ATTRIBUTES));
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Invalidating Attributes. Namespace:" + ns);
+ }
}
public void putProperties(String ns, Role role, Map<String, String> properties)
@@ -577,7 +607,7 @@
{
Map<String, String> props = (Map<String, String>)node.get(NODE_OBJECT_KEY);
- if (log.isLoggable(Level.FINER))
+ if (log.isLoggable(Level.FINER) && props != null)
{
log.finer(this.toString() + "Role properties found in cache: properties.size()=" + props.size() +
"; role=" + role);
@@ -592,11 +622,19 @@
public void invalidateRoleProperties(String ns, Role role)
{
cache.getRoot().removeChild(getFqn(ns, NODE_ROLE_PROPERTIES, role.hashCode()));
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Invalidating Role properties. role=" + role + "; Namespace:" + ns);
+ }
}
public void invalidateRoleProperties(String ns)
{
cache.getRoot().removeChild(getFqn(ns, NODE_ROLE_PROPERTIES));
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Invalidating Role properties. Namespace:" + ns);
+ }
}
public void putProperties(String ns, RoleType roleType, Map<String, String> properties)
@@ -623,7 +661,7 @@
{
Map<String, String> props = (Map<String, String>)node.get(NODE_OBJECT_KEY);
- if (log.isLoggable(Level.FINER))
+ if (log.isLoggable(Level.FINER) && props != null)
{
log.finer(this.toString() + "RoleType properties found in cache: properties.size()=" + props.size() +
"; roleType=" + roleType);
@@ -638,11 +676,19 @@
public void invalidateRoleTypeProperties(String ns, RoleType roleType)
{
cache.getRoot().removeChild(getFqn(ns, NODE_ROLE_PROPERTIES, roleType.hashCode()));
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Invalidating RoleType properties. roleType=" + roleType + "; Namespace:" + ns);
+ }
}
public void invalidateRoleTypeProperties(String ns)
{
cache.getRoot().removeChild(getFqn(ns, NODE_ROLE_PROPERTIES));
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Invalidating RoleType properties. Namespace:" + ns);
+ }
}
public void invalidateAllSearches(String ns)
@@ -652,6 +698,10 @@
cache.getRoot().removeChild(getFqn(ns, NODE_RELATIONSHIP_SEARCHES));
cache.getRoot().removeChild(getFqn(ns, NODE_ROLE_SEARCHES));
cache.getRoot().removeChild(getFqn(ns, NODE_ROLE_TYPE_SEARCHES));
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Invalidating all searches. Namespace:" + ns);
+ }
}
public void putUserSearch(String ns, UserSearch search, Collection<User> results)
@@ -678,7 +728,7 @@
{
Collection<User> props = (Collection<User>)node.get(NODE_OBJECT_KEY);
- if (log.isLoggable(Level.FINER))
+ if (log.isLoggable(Level.FINER) && props != null)
{
log.finer(this.toString() + "User search found in cache: properties.size()=" + props.size());
}
@@ -713,7 +763,7 @@
{
Collection<Group> results = (Collection<Group>)node.get(NODE_OBJECT_KEY);
- if (log.isLoggable(Level.FINER))
+ if (log.isLoggable(Level.FINER) && results != null)
{
log.finer(this.toString() + "Group search found in cache: results.size()=" + results.size());
}
@@ -748,7 +798,7 @@
{
Boolean result = (Boolean)node.get(NODE_OBJECT_KEY);
- if (log.isLoggable(Level.FINER))
+ if (log.isLoggable(Level.FINER) && result != null)
{
log.finer(this.toString() + "Relationship search found in cache: properties.size()=" + result);
}
@@ -783,7 +833,7 @@
{
Collection<Role> results = (Collection<Role>)node.get(NODE_OBJECT_KEY);
- if (log.isLoggable(Level.FINER))
+ if (log.isLoggable(Level.FINER) && results != null)
{
log.finer(this.toString() + "Role search found in cache: results.size()=" + results.size());
}
@@ -818,7 +868,7 @@
{
Collection<RoleType> results = (Collection<RoleType>)node.get(NODE_OBJECT_KEY);
- if (log.isLoggable(Level.FINER))
+ if (log.isLoggable(Level.FINER) && results != null)
{
log.finer(this.toString() + "RoleType search found in cache: results.size()=" + results.size());
}
@@ -834,6 +884,10 @@
cache.getRoot().removeChild(getFqn(ns, NODE_USERS_QUERIES));
cache.getRoot().removeChild(getFqn(ns, NODE_GROUPS_QUERIES));
cache.getRoot().removeChild(getFqn(ns, NODE_ROLE_QUERIES));
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Invalidating all queries. Namespace:" + ns);
+ }
}
@@ -875,7 +929,7 @@
{
Collection<User> users = (Collection<User>)node.get(NODE_QUERY_KEY);
- if (log.isLoggable(Level.FINER))
+ if (log.isLoggable(Level.FINER) && users != null)
{
log.finer(this.toString() + "User query found in cache: users.size()=" + users.size() +
"; query.hash()=" + q.hashCode());
@@ -897,7 +951,7 @@
{
User users = (User)node.get(NODE_QUERY_UNIQUE_KEY);
- if (log.isLoggable(Level.FINER))
+ if (log.isLoggable(Level.FINER) && users != null)
{
log.finer(this.toString() + "User query found in cache: user=" + users);
}
@@ -911,6 +965,10 @@
public void invalidateUserQueries(String ns)
{
cache.getRoot().removeChild(getFqn(ns, NODE_USERS_QUERIES));
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Invalidating User queries. Namespace:" + ns);
+ }
}
public void putGroupQuery(String ns, GroupQuery q, Collection<Group> results)
@@ -951,7 +1009,7 @@
{
Collection<Group> groups = (Collection<Group>)node.get(NODE_QUERY_KEY);
- if (log.isLoggable(Level.FINER))
+ if (log.isLoggable(Level.FINER) && groups != null)
{
log.finer(this.toString() + "Group query found in cache: groups.size()=" + groups.size() +
"; query.hash()=" + q.hashCode());
@@ -973,7 +1031,7 @@
{
Group group = (Group)node.get(NODE_QUERY_UNIQUE_KEY);
- if (log.isLoggable(Level.FINER))
+ if (log.isLoggable(Level.FINER) && group != null)
{
log.finer(this.toString() + "Group query found in cache: group=" + group);
}
@@ -987,6 +1045,10 @@
public void invalidateGroupQueries(String ns)
{
cache.getRoot().removeChild(getFqn(ns, NODE_GROUPS_QUERIES));
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Invalidating Group queries. Namespace:" + ns);
+ }
}
public void putRoleQuery(String ns, RoleQuery q, Collection<Role> results)
@@ -1026,7 +1088,7 @@
{
Collection<Role> roles = (Collection<Role>)node.get(NODE_QUERY_KEY);
- if (log.isLoggable(Level.FINER))
+ if (log.isLoggable(Level.FINER) && roles != null)
{
log.finer(this.toString() + "Role query found in cache: users.size()=" + roles.size() +
"; query.hash()=" + q.hashCode());
@@ -1048,7 +1110,7 @@
{
Role role = (Role)node.get(NODE_QUERY_UNIQUE_KEY);
- if (log.isLoggable(Level.FINER))
+ if (log.isLoggable(Level.FINER) && role != null)
{
log.finer(this.toString() + "Role query found in cache: role=" + role);
}
@@ -1062,5 +1124,9 @@
public void invalidateRoleQueries(String ns)
{
cache.getRoot().removeChild(getFqn(ns, NODE_ROLE_QUERIES));
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Invalidating Role queries. Namespace:" + ns);
+ }
}
}
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/IdentitySessionFactoryImpl.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/IdentitySessionFactoryImpl.java 2009-11-04 22:30:01 UTC (rev 905)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/IdentitySessionFactoryImpl.java 2009-11-05 12:19:23 UTC (rev 906)
@@ -51,8 +51,6 @@
this.sessionContextMap = sessionContextMap;
}
-
-
public void close()
{
//TODO: close all sessions and put closed state?
Modified: idm/trunk/idm-testsuite/pom.xml
===================================================================
--- idm/trunk/idm-testsuite/pom.xml 2009-11-04 22:30:01 UTC (rev 905)
+++ idm/trunk/idm-testsuite/pom.xml 2009-11-05 12:19:23 UTC (rev 906)
@@ -172,6 +172,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>2.4.3</version>
<configuration>
+ <useFile>true</useFile>
<systemProperties>
<property>
<name>dataSourceName</name>
@@ -189,6 +190,10 @@
<name>trustStorePassword</name>
<value>${trustStorePassword}</value>
</property>
+ <property>
+ <name>java.util.logging.config.file</name>
+ <value>../parent/logging.properties</value>
+ </property>
</systemProperties>
</configuration>
</plugin>
Modified: idm/trunk/parent/logging.properties
===================================================================
--- idm/trunk/parent/logging.properties 2009-11-04 22:30:01 UTC (rev 905)
+++ idm/trunk/parent/logging.properties 2009-11-05 12:19:23 UTC (rev 906)
@@ -33,14 +33,15 @@
#myapp.business.level=CONFIG
#myapp.data.level=SEVERE
-org.jboss.identity.idm.level=FINER
+#org.jboss.identity.idm.level=FINE
+org.jboss.identity.idm.impl.cache.level=FINER
# Handlers
# -----------------------------------------
# --- ConsoleHandler ---
# Override of global logging level
-java.util.logging.ConsoleHandler.level=ALL
+java.util.logging.ConsoleHandler.level=FINER
java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter
# --- FileHandler ---
16 years, 6 months
JBoss Identity SVN: r905 - in idm/trunk: idm-cache and 12 other directories.
by jboss-identity-commits@lists.jboss.org
Author: bdaw
Date: 2009-11-04 17:30:01 -0500 (Wed, 04 Nov 2009)
New Revision: 905
Added:
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/cache/GroupSearch.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/cache/RelationshipSearch.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/cache/RoleSearch.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/cache/RoleTypeSearch.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/cache/Search.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/cache/UserSearch.java
idm/trunk/idm-cache/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheAPICacheProviderImpl.java
idm/trunk/idm-cache/src/test/java/org/jboss/identity/idm/cache/
idm/trunk/idm-cache/src/test/java/org/jboss/identity/idm/cache/APICacheProviderTestCase.java
idm/trunk/idm-cache/src/test/resources/jboss-cache.xml
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/AbstractSearch.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/GroupSearchImpl.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/RelationshipSearchImpl.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/RoleSearchImpl.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/RoleTypeSearchImpl.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/UserSearchImpl.java
idm/trunk/idm-testsuite/src/test/resources/jboss-cache.xml
Modified:
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/cache/APICacheProvider.java
idm/trunk/idm-cache/pom.xml
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/IdentitySearchCriteriaImpl.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/IdentitySessionFactoryImpl.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/model/GroupId.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/AbstractQuery.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/UserQueryImpl.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/IdentitySessionImpl.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AbstractManager.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AttributesManagerImpl.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/PersistenceManagerImpl.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RelationshipManagerImpl.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RoleManagerImpl.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/configuration/IdentityConfigurationImpl.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/configuration/IdentitySessionConfigurationContext.java
idm/trunk/idm-testsuite/src/test/resources/test-identity-config.xml
Log:
- API cache
Modified: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/cache/APICacheProvider.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/cache/APICacheProvider.java 2009-11-03 14:33:23 UTC (rev 904)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/cache/APICacheProvider.java 2009-11-04 22:30:01 UTC (rev 905)
@@ -21,11 +21,7 @@
*/
package org.jboss.identity.idm.cache;
-import org.jboss.identity.idm.api.Attribute;
-import org.jboss.identity.idm.api.Group;
-import org.jboss.identity.idm.api.IdentitySearchCriteria;
-import org.jboss.identity.idm.api.Role;
-import org.jboss.identity.idm.api.User;
+import org.jboss.identity.idm.api.*;
import org.jboss.identity.idm.api.query.GroupQuery;
import org.jboss.identity.idm.api.query.RoleQuery;
import org.jboss.identity.idm.api.query.UserQuery;
@@ -43,7 +39,16 @@
public interface APICacheProvider
{
+
/**
+ * Initialize provider.
+ * @param properties
+ */
+ void initialize(Map<String, String> properties);
+
+ void invalidate(String ns);
+
+ /**
* Generate realm namespace.
*
* @param realmId - if null will generate root namespace
@@ -92,6 +97,8 @@
void putGroups(String ns, IdentitySearchCriteria criteria, Collection<Group> groups);
+ Collection<Group> getGroups(String ns, IdentitySearchCriteria criteria);
+
void invalidateGroups(String ns);
void putGroupCount(String ns, String groupType, int count);
@@ -100,57 +107,106 @@
void invalidateGroupCount(String ns, String groupType);
+ //
+ void putRole(String ns, Role role);
+ Role getRole(String ns, Role role);
+
+ void removeRole(String ns, Role role);
+
+ void putRoleType(String ns, RoleType roleType);
+
+ RoleType getRoleType(String ns, RoleType roleType);
+
+ void removeRoleType(String ns, RoleType roleType);
+
+
// Attribute
void putAttributes(String ns, String id, Map<String, Attribute> attributes);
Map<String, Attribute> getAttributes(String ns, String id);
+ void invalidateAttributes(String ns, String id);
+ void invalidateAttributes(String ns);
+
+ // Properties
+ void putProperties(String ns, Role role, Map<String, String> properties);
+
+ Map<String, String> getProperties(String ns, Role role);
+
+ void invalidateRoleProperties(String ns, Role role);
+
+ void invalidateRoleProperties(String ns);
+
+ void putProperties(String ns, RoleType roleType, Map<String, String> properties);
+
+ Map<String, String> getProperties(String ns, RoleType roleType);
+
+ void invalidateRoleTypeProperties(String ns, RoleType roleType);
+
+ void invalidateRoleTypeProperties(String ns);
+
+
+ // Searches
+
+ void invalidateAllSearches(String ns);
+
+ void putUserSearch(String ns, UserSearch search, Collection<User> results);
+
+ Collection<User> getUserSearch(String ns, UserSearch search);
+
+ void putGroupSearch(String ns, GroupSearch search, Collection<Group> results);
+
+ Collection<Group> getGroupSearch(String ns, GroupSearch search);
+
+ void putRelationshipSearch(String ns, RelationshipSearch search, Boolean result);
+
+ Boolean getRelationshipSearch(String ns, RelationshipSearch search);
+
+ void putRoleSearch(String ns, RoleSearch search, Collection<Role> results);
+
+ Collection<Role> getRoleSearch(String ns, RoleSearch search);
+
+ void putRoleTypeSearch(String ns, RoleTypeSearch search, Collection<RoleType> results);
+
+ Collection<RoleType> getRoleTypeSearch(String ns, RoleTypeSearch search);
+
+
// Queries
+ void invalidateAllQueries(String ns);
+
void putUserQuery(String ns, UserQuery q, Collection<User> results);
- void putUserQueryList(String ns, UserQuery q, List<User> results);
-
void putUserQueryUnique(String ns, UserQuery q, User user);
- Collection<User> getUserQuery(String ns, UserQuery q, Collection<User> results);
+ Collection<User> getUserQuery(String ns, UserQuery q);
- List<User> getUserQueryList(String ns, UserQuery q, List<User> results);
+ User getUserQueryUnique(String ns, UserQuery q);
- User getUserQueryUnique(String ns, UserQuery q, User user);
-
void invalidateUserQueries(String ns);
//
void putGroupQuery(String ns, GroupQuery q, Collection<Group> results);
- void putGroupQueryList(String ns, GroupQuery q, List<Group> results);
-
void putGroupQueryUnique(String ns, GroupQuery q, Group group);
- Collection<Group> getGroupQuery(String ns, GroupQuery q, Collection<Group> results);
+ Collection<Group> getGroupQuery(String ns, GroupQuery q);
- List<Group> getGroupQueryList(String ns, GroupQuery q, List<Group> results);
+ Group getGroupQueryUnique(String ns, GroupQuery q);
- Group getGroupQueryUnique(String ns, GroupQuery q, Group group);
-
void invalidateGroupQueries(String ns);
//
void putRoleQuery(String ns, RoleQuery q, Collection<Role> results);
- void putRoleQueryList(String ns, RoleQuery q, List<Role> results);
-
void putRoleQueryUnique(String ns, RoleQuery q, Role role);
- Collection<Role> getRoleQuery(String ns, RoleQuery q, Collection<Role> results);
+ Collection<Role> getRoleQuery(String ns, RoleQuery q);
- List<Role> getRoleQueryList(String ns, RoleQuery q, List<Role> results);
+ Role getRoleQueryUnique(String ns, RoleQuery q);
- Role getRoleQueryUnique(String ns, RoleQuery q, Role role);
-
void invalidateRoleQueries(String ns);
}
Added: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/cache/GroupSearch.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/cache/GroupSearch.java (rev 0)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/cache/GroupSearch.java 2009-11-04 22:30:01 UTC (rev 905)
@@ -0,0 +1,30 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2009, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* 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.identity.idm.cache;
+
+import java.io.Serializable;
+
+public interface GroupSearch extends Search
+{
+}
Added: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/cache/RelationshipSearch.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/cache/RelationshipSearch.java (rev 0)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/cache/RelationshipSearch.java 2009-11-04 22:30:01 UTC (rev 905)
@@ -0,0 +1,29 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2009, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* 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.identity.idm.cache;
+
+public interface RelationshipSearch extends Search
+{
+
+}
Added: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/cache/RoleSearch.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/cache/RoleSearch.java (rev 0)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/cache/RoleSearch.java 2009-11-04 22:30:01 UTC (rev 905)
@@ -0,0 +1,30 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2009, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* 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.identity.idm.cache;
+
+import java.io.Serializable;
+
+public interface RoleSearch extends Search
+{
+}
Added: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/cache/RoleTypeSearch.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/cache/RoleTypeSearch.java (rev 0)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/cache/RoleTypeSearch.java 2009-11-04 22:30:01 UTC (rev 905)
@@ -0,0 +1,30 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2009, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* 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.identity.idm.cache;
+
+import java.io.Serializable;
+
+public interface RoleTypeSearch extends Search
+{
+}
Added: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/cache/Search.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/cache/Search.java (rev 0)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/cache/Search.java 2009-11-04 22:30:01 UTC (rev 905)
@@ -0,0 +1,37 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2009, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* 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.identity.idm.cache;
+
+import org.jboss.identity.idm.api.IdentitySearchCriteria;
+
+import java.io.Serializable;
+
+public interface Search extends Serializable
+{
+
+ IdentitySearchCriteria getSearchCriteria();
+
+ void setSearchCriteria(IdentitySearchCriteria searchCriteria);
+
+}
Added: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/cache/UserSearch.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/cache/UserSearch.java (rev 0)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/cache/UserSearch.java 2009-11-04 22:30:01 UTC (rev 905)
@@ -0,0 +1,28 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2009, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* 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.identity.idm.cache;
+
+import java.io.Serializable;
+
+public interface UserSearch extends Search
+{
+}
Modified: idm/trunk/idm-cache/pom.xml
===================================================================
--- idm/trunk/idm-cache/pom.xml 2009-11-03 14:33:23 UTC (rev 904)
+++ idm/trunk/idm-cache/pom.xml 2009-11-04 22:30:01 UTC (rev 905)
@@ -34,11 +34,16 @@
<version>${project.version}</version>
</dependency>
-
<dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
<groupId>org.jboss.cache</groupId>
<artifactId>jbosscache-core</artifactId>
- <version>3.0.2.GA</version>
+ <version>3.2.1.GA</version>
</dependency>
</dependencies>
Added: idm/trunk/idm-cache/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheAPICacheProviderImpl.java
===================================================================
--- idm/trunk/idm-cache/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheAPICacheProviderImpl.java (rev 0)
+++ idm/trunk/idm-cache/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheAPICacheProviderImpl.java 2009-11-04 22:30:01 UTC (rev 905)
@@ -0,0 +1,1066 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2009, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* 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.identity.idm.impl.cache;
+
+import org.jboss.identity.idm.cache.*;
+import org.jboss.identity.idm.api.*;
+import org.jboss.identity.idm.api.query.UserQuery;
+import org.jboss.identity.idm.api.query.GroupQuery;
+import org.jboss.identity.idm.api.query.RoleQuery;
+import org.jboss.identity.idm.impl.api.model.GroupId;
+import org.jboss.cache.*;
+
+import java.util.Map;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.logging.Logger;
+import java.util.logging.Level;
+
+
+/**
+ *
+ */
+public class JBossCacheAPICacheProviderImpl implements APICacheProvider
+{
+ //TODO: dobule check if invalidate methods remove everything that is needed...
+
+ private static Logger log = Logger.getLogger(JBossCacheAPICacheProviderImpl.class.getName());
+
+ private Cache cache;
+
+ public static final String CONFIG_FILE_OPTION = "cache.configFile";
+
+ public static final String NODE_OBJECT_KEY = "object";
+
+ public static final String NODE_QUERY_KEY = "query";
+
+ public static final String NODE_QUERY_UNIQUE_KEY = "query_unique";
+
+ public static final String NODE_MAIN_ROOT = "IDM_ROOT";
+
+ public static final String NODE_USERS = "USERS";
+
+ public static final String NODE_USERS_COUNT = "USERS_COUNT";
+
+ public static final String NODE_USERS_QUERIES = "USERS_QUERIES";
+
+ public static final String NODE_USERS_CRITERIA = "USERS_CRITERIA";
+
+ public static final String NODE_USERS_SEARCHES = "USERS_SEARCHES";
+
+ public static final String NODE_GROUPS = "GROUPS";
+
+ public static final String NODE_GROUPS_COUNT = "GROUPS_COUNT";
+
+ public static final String NODE_GROUPS_QUERIES = "GROUPS_QUERIES";
+
+ public static final String NODE_GROUPS_CRITERIA = "GROUPS_CRITERIA";
+
+ public static final String NODE_GROUPS_SEARCHES = "GROUPS_SEARCHES";
+
+ public static final String NODE_ROLES = "ROLES";
+
+ public static final String NODE_ROLE_TYPES = "ROLE_TYPES";
+
+ public static final String NODE_ROLE_QUERIES = "ROLE_QUERIES";
+
+ public static final String NODE_ATTRIBUTES = "ATTRIBUTES";
+
+ public static final String NODE_ROLE_PROPERTIES = "NODE_ROLE_PROPERTIES";
+
+ public static final String NODE_ROLE_TYPE_PROPERTIES = "NODE_ROLE_TYPE_PROPERTIES";
+
+ public static final String NODE_ROLE_SEARCHES = "NODE_ROLE_SEARCHES";
+
+ public static final String NODE_ROLE_TYPE_SEARCHES = "NODE_ROLE_TYPE_SEARCHES";
+
+ public static final String NODE_RELATIONSHIP_SEARCHES = "NODE_ROLE_TYPE_SEARCHES";
+
+ private Fqn getNamespacedFqn(String ns)
+ {
+ return Fqn.fromElements("NODE_MAIN_ROOT", ns);
+ }
+
+ private Fqn getFqn(String ns, String node, Object o)
+ {
+ return Fqn.fromElements(getNamespacedFqn(ns), node, o);
+ }
+
+ private Fqn getFqn(String ns, String node)
+ {
+ return Fqn.fromElements(getNamespacedFqn(ns), node);
+ }
+
+ public void initialize(Map<String, String> properties)
+ {
+ CacheFactory factory = new DefaultCacheFactory();
+
+ String config = properties.get(CONFIG_FILE_OPTION);
+
+ if (config == null)
+ {
+ throw new IllegalArgumentException("Cannot find '" + CONFIG_FILE_OPTION + "' in passed properties. Failed to initialize" +
+ "cache provider.");
+ }
+
+ this.cache = factory.createCache(config);
+
+ this.cache.create();
+ this.cache.start();
+
+ }
+
+ Cache getCache()
+ {
+ return cache;
+ }
+
+
+ public void invalidate(String ns)
+ {
+ cache.getRoot().removeChild(getNamespacedFqn(ns));
+ }
+
+ public String getNamespace(String realmId)
+ {
+ return realmId;
+ }
+
+ public String getNamespace(String realmId, String sessionId)
+ {
+ return realmId + "/" + sessionId;
+ }
+
+ public void putUser(String ns, User user)
+ {
+ Fqn nodeFqn = getFqn(ns, NODE_USERS, user.getId());
+
+ Node ioNode = getCache().getRoot().addChild(nodeFqn);
+
+
+ ioNode.put(NODE_OBJECT_KEY, user);
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "User stored in cache: " + user.getId());
+ }
+ }
+
+ public User getUser(String ns, String id)
+ {
+ Fqn nodeFqn = getFqn(ns, NODE_USERS, id);
+
+ Node node = getCache().getRoot().getChild(nodeFqn);
+
+ if (node != null)
+ {
+ User user = (User)node.get(NODE_OBJECT_KEY);
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "User found in cache: id=" + user.getId());
+ }
+
+ return user;
+ }
+
+ return null;
+ }
+
+ public void removeUser(String ns, String id)
+ {
+ Fqn nodeFqn = getFqn(ns, NODE_USERS, id);
+
+ getCache().getRoot().removeChild(nodeFqn);
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "User removed from cache: id= " + id);
+ }
+ }
+
+ public void putUsers(String ns, IdentitySearchCriteria criteria, Collection<User> users)
+ {
+ Fqn nodeFqn = getFqn(ns, NODE_USERS_CRITERIA, criteria.hashCode());
+
+ Node ioNode = getCache().getRoot().addChild(nodeFqn);
+
+ ioNode.put(NODE_OBJECT_KEY, Collections.unmodifiableCollection(users));
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "User criteria search stored in cache: users.size()=" + users.size() +
+ "; criteria.hash()=" + criteria.hashCode());
+ }
+ }
+
+ public Collection<User> getUsers(String ns, IdentitySearchCriteria criteria)
+ {
+ Fqn nodeFqn = getFqn(ns, NODE_USERS_CRITERIA, criteria.hashCode());
+
+ Node node = getCache().getRoot().getChild(nodeFqn);
+
+ if (node != null)
+ {
+ Collection<User> users = (Collection<User>)node.get(NODE_OBJECT_KEY);
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "User criteria search found in cache: users.size()=" + users.size() +
+ "; criteria.hash()=" + criteria.hashCode());
+ }
+
+ return users;
+ }
+
+ return null;
+ }
+
+ public void invalidateUsers(String ns)
+ {
+ getCache().getRoot().removeChild(Fqn.fromElements(getNamespacedFqn(ns), NODE_USERS));
+ getCache().getRoot().removeChild(Fqn.fromElements(getNamespacedFqn(ns), NODE_USERS_COUNT));
+ getCache().getRoot().removeChild(Fqn.fromElements(getNamespacedFqn(ns), NODE_USERS_CRITERIA));
+ getCache().getRoot().removeChild(Fqn.fromElements(getNamespacedFqn(ns), NODE_USERS_QUERIES));
+ }
+
+ public void putUserCount(String ns, int count)
+ {
+ Fqn nodeFqn = getFqn(ns, NODE_USERS_COUNT);
+
+ Node ioNode = getCache().getRoot().addChild(nodeFqn);
+
+ ioNode.put(NODE_OBJECT_KEY, count);
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Users count stored in cache: " + count);
+ }
+ }
+
+ public int getUserCount(String ns)
+ {
+ Fqn nodeFqn = getFqn(ns, NODE_USERS_COUNT);
+
+ Node node = getCache().getRoot().getChild(nodeFqn);
+
+ if (node != null)
+ {
+ int count = -1;
+ Integer i = (Integer)node.get(NODE_OBJECT_KEY);
+ if (i != null)
+ {
+ count = i.intValue();
+ }
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "User count found in cache: " + count);
+ }
+
+ return count;
+ }
+
+ return -1;
+ }
+
+ public void invalidateUserCount(String ns)
+ {
+ getCache().getRoot().removeChild(Fqn.fromElements(getNamespacedFqn(ns), NODE_USERS_COUNT));
+ }
+
+ public void putGroup(String ns, Group group)
+ {
+ Fqn nodeFqn = getFqn(ns, NODE_GROUPS, group.getId());
+
+ Node ioNode = getCache().getRoot().addChild(nodeFqn);
+
+ ioNode.put(NODE_OBJECT_KEY, group);
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Group stored in cache: " + group.getId());
+ }
+ }
+
+ public Group getGroup(String ns, String groupType, String groupName)
+ {
+ Fqn nodeFqn = getFqn(ns, NODE_GROUPS, GroupId.parseId(groupName, groupType));
+
+ Node node = getCache().getRoot().getChild(nodeFqn);
+
+ if (node != null)
+ {
+ Group group = (Group)node.get(NODE_OBJECT_KEY);
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Group found in cache: id=" + group.getId());
+ }
+
+ return group;
+ }
+
+ return null;
+ }
+
+ public void removeGroup(String ns, String groupType, String groupName)
+ {
+ Fqn nodeFqn = getFqn(ns, NODE_GROUPS, GroupId.parseId(groupName, groupType));
+
+ getCache().getRoot().removeChild(nodeFqn);
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Group removed from cache: id= " + GroupId.parseId(groupName, groupType));
+ }
+ }
+
+ public void putGroups(String ns, IdentitySearchCriteria criteria, Collection<Group> groups)
+ {
+ Fqn nodeFqn = getFqn(ns, NODE_GROUPS_CRITERIA, criteria.hashCode());
+
+ Node ioNode = getCache().getRoot().addChild(nodeFqn);
+
+ ioNode.put(NODE_OBJECT_KEY, Collections.unmodifiableCollection(groups));
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Group criteria search stored in cache: groups.size()=" + groups.size() +
+ "; criteria.hash()=" + criteria.hashCode());
+ }
+ }
+
+ public Collection<Group> getGroups(String ns, IdentitySearchCriteria criteria)
+ {
+ Fqn nodeFqn = getFqn(ns, NODE_GROUPS_CRITERIA, criteria.hashCode());
+
+ Node node = getCache().getRoot().getChild(nodeFqn);
+
+ if (node != null)
+ {
+ Collection<Group> groups = (Collection<Group>)node.get(NODE_OBJECT_KEY);
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Group criteria search found in cache: groups.size()=" + groups.size() +
+ "; criteria.hash()=" + criteria.hashCode());
+ }
+
+ return groups;
+ }
+
+ return null;
+ }
+
+ public void invalidateGroups(String ns)
+ {
+ getCache().getRoot().removeChild(Fqn.fromElements(getNamespacedFqn(ns), NODE_GROUPS));
+ getCache().getRoot().removeChild(Fqn.fromElements(getNamespacedFqn(ns), NODE_GROUPS_COUNT));
+ getCache().getRoot().removeChild(Fqn.fromElements(getNamespacedFqn(ns), NODE_GROUPS_CRITERIA));
+ getCache().getRoot().removeChild(Fqn.fromElements(getNamespacedFqn(ns), NODE_GROUPS_QUERIES));
+ }
+
+ public void putGroupCount(String ns, String groupType, int count)
+ {
+ Fqn nodeFqn = getFqn(ns, NODE_GROUPS_COUNT, groupType);
+
+ Node ioNode = getCache().getRoot().addChild(nodeFqn);
+
+ ioNode.put(NODE_OBJECT_KEY, count);
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Group count stored in cache: type=" + groupType + "; count=" + count);
+ }
+ }
+
+ public int getGroupCount(String ns, String groupType)
+ {
+ Fqn nodeFqn = getFqn(ns, NODE_GROUPS_COUNT, groupType);
+
+ Node node = getCache().getRoot().getChild(nodeFqn);
+
+ if (node != null)
+ {
+ int count = -1;
+ Integer i = (Integer)node.get(NODE_OBJECT_KEY);
+ if (i != null)
+ {
+ count = i.intValue();
+ }
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Group count found in cache: groupType=" + groupType + "; count=" + count);
+ }
+
+ return count;
+ }
+
+ return -1;
+ }
+
+ public void invalidateGroupCount(String ns, String groupType)
+ {
+ cache.getRoot().removeChild(getFqn(ns, NODE_GROUPS_COUNT, groupType));
+ }
+
+ public void putRole(String ns, Role role)
+ {
+ Fqn nodeFqn = getFqn(ns, NODE_ROLES, role.hashCode());
+
+ Node ioNode = getCache().getRoot().addChild(nodeFqn);
+
+
+ ioNode.put(NODE_OBJECT_KEY, role);
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Role stored in cache: " + role);
+ }
+ }
+
+ public Role getRole(String ns, Role role)
+ {
+ Fqn nodeFqn = getFqn(ns, NODE_ROLES, role.hashCode());
+
+ Node node = getCache().getRoot().getChild(nodeFqn);
+
+ if (node != null)
+ {
+ Role result = (Role)node.get(NODE_OBJECT_KEY);
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Role found in cache: id=" + result);
+ }
+
+ return result;
+ }
+
+ return null;
+ }
+
+ public void removeRole(String ns, Role role)
+ {
+ cache.getRoot().removeChild(getFqn(ns, NODE_ROLES, role.hashCode()));
+ }
+
+ public void putRoleType(String ns, RoleType role)
+ {
+ Fqn nodeFqn = getFqn(ns, NODE_ROLE_TYPES, role.getName());
+
+ Node ioNode = getCache().getRoot().addChild(nodeFqn);
+
+
+ ioNode.put(NODE_OBJECT_KEY, role);
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "RoleType stored in cache: name=" + role.getName());
+ }
+ }
+
+ public RoleType getRoleType(String ns, RoleType role)
+ {
+ Fqn nodeFqn = getFqn(ns, NODE_ROLE_TYPES, role.getName());
+
+ Node node = getCache().getRoot().getChild(nodeFqn);
+
+ if (node != null)
+ {
+ RoleType result = (RoleType)node.get(NODE_OBJECT_KEY);
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "RoleType found in cache: name=" + role.getName());
+ }
+
+ return result;
+ }
+
+ return null;
+ }
+
+ public void removeRoleType(String ns, RoleType roleType)
+ {
+ cache.getRoot().removeChild(getFqn(ns, NODE_ROLE_TYPES, roleType.getName()));
+ }
+
+ public void putAttributes(String ns, String id, Map<String, Attribute> attributes)
+ {
+ Fqn nodeFqn = getFqn(ns, NODE_ATTRIBUTES, id);
+
+ Node ioNode = getCache().getRoot().addChild(nodeFqn);
+
+ ioNode.put(NODE_OBJECT_KEY, Collections.unmodifiableMap(attributes));
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Attributes stored in cache: id=" + id + "; attributes.size()=" + attributes.size());
+ }
+ }
+
+ public Map<String, Attribute> getAttributes(String ns, String id)
+ {
+ Fqn nodeFqn = getFqn(ns, NODE_ATTRIBUTES, id);
+
+ Node node = getCache().getRoot().getChild(nodeFqn);
+
+ if (node != null)
+ {
+ Map<String, Attribute> attributes = (Map<String, Attribute>)node.get(NODE_OBJECT_KEY);
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Attributes search found in cache: attributes.size()=" + attributes.size() +
+ "; id=" + id);
+ }
+
+ return attributes;
+ }
+
+ return null;
+ }
+
+ public void invalidateAttributes(String ns, String id)
+ {
+ cache.getRoot().removeChild(getFqn(ns, NODE_ATTRIBUTES, id));
+ }
+
+ public void invalidateAttributes(String ns)
+ {
+ cache.getRoot().removeChild(getFqn(ns, NODE_ATTRIBUTES));
+ }
+
+ public void putProperties(String ns, Role role, Map<String, String> properties)
+ {
+ Fqn nodeFqn = getFqn(ns, NODE_ROLE_PROPERTIES, role.hashCode());
+
+ Node ioNode = getCache().getRoot().addChild(nodeFqn);
+
+ ioNode.put(NODE_OBJECT_KEY, Collections.unmodifiableMap(properties));
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Role properties stored in cache: role=" + role + "; properties.size()=" + properties.size());
+ }
+ }
+
+ public Map<String, String> getProperties(String ns, Role role)
+ {
+ Fqn nodeFqn = getFqn(ns, NODE_ROLE_PROPERTIES, role.hashCode());
+
+ Node node = getCache().getRoot().getChild(nodeFqn);
+
+ if (node != null)
+ {
+ Map<String, String> props = (Map<String, String>)node.get(NODE_OBJECT_KEY);
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Role properties found in cache: properties.size()=" + props.size() +
+ "; role=" + role);
+ }
+
+ return props;
+ }
+
+ return null;
+ }
+
+ public void invalidateRoleProperties(String ns, Role role)
+ {
+ cache.getRoot().removeChild(getFqn(ns, NODE_ROLE_PROPERTIES, role.hashCode()));
+ }
+
+ public void invalidateRoleProperties(String ns)
+ {
+ cache.getRoot().removeChild(getFqn(ns, NODE_ROLE_PROPERTIES));
+ }
+
+ public void putProperties(String ns, RoleType roleType, Map<String, String> properties)
+ {
+ Fqn nodeFqn = getFqn(ns, NODE_ROLE_TYPE_PROPERTIES, roleType.hashCode());
+
+ Node ioNode = getCache().getRoot().addChild(nodeFqn);
+
+ ioNode.put(NODE_OBJECT_KEY, Collections.unmodifiableMap(properties));
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "RoleType properties stored in cache: roleType=" + roleType + "; properties.size()=" + properties.size());
+ }
+ }
+
+ public Map<String, String> getProperties(String ns, RoleType roleType)
+ {
+ Fqn nodeFqn = getFqn(ns, NODE_ROLE_TYPE_PROPERTIES, roleType.hashCode());
+
+ Node node = getCache().getRoot().getChild(nodeFqn);
+
+ if (node != null)
+ {
+ Map<String, String> props = (Map<String, String>)node.get(NODE_OBJECT_KEY);
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "RoleType properties found in cache: properties.size()=" + props.size() +
+ "; roleType=" + roleType);
+ }
+
+ return props;
+ }
+
+ return null;
+ }
+
+ public void invalidateRoleTypeProperties(String ns, RoleType roleType)
+ {
+ cache.getRoot().removeChild(getFqn(ns, NODE_ROLE_PROPERTIES, roleType.hashCode()));
+ }
+
+ public void invalidateRoleTypeProperties(String ns)
+ {
+ cache.getRoot().removeChild(getFqn(ns, NODE_ROLE_PROPERTIES));
+ }
+
+ public void invalidateAllSearches(String ns)
+ {
+ cache.getRoot().removeChild(getFqn(ns, NODE_USERS_SEARCHES));
+ cache.getRoot().removeChild(getFqn(ns, NODE_GROUPS_SEARCHES));
+ cache.getRoot().removeChild(getFqn(ns, NODE_RELATIONSHIP_SEARCHES));
+ cache.getRoot().removeChild(getFqn(ns, NODE_ROLE_SEARCHES));
+ cache.getRoot().removeChild(getFqn(ns, NODE_ROLE_TYPE_SEARCHES));
+ }
+
+ public void putUserSearch(String ns, UserSearch search, Collection<User> results)
+ {
+ Fqn nodeFqn = getFqn(ns, NODE_USERS_SEARCHES, search.hashCode());
+
+ Node ioNode = getCache().getRoot().addChild(nodeFqn);
+
+ ioNode.put(NODE_OBJECT_KEY, Collections.unmodifiableCollection(results));
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "User search stored in cache: results.size()=" + results.size());
+ }
+ }
+
+ public Collection<User> getUserSearch(String ns, UserSearch search)
+ {
+ Fqn nodeFqn = getFqn(ns, NODE_USERS_SEARCHES, search.hashCode());
+
+ Node node = getCache().getRoot().getChild(nodeFqn);
+
+ if (node != null)
+ {
+ Collection<User> props = (Collection<User>)node.get(NODE_OBJECT_KEY);
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "User search found in cache: properties.size()=" + props.size());
+ }
+
+ return props;
+ }
+
+ return null;
+ }
+
+ public void putGroupSearch(String ns, GroupSearch search, Collection<Group> results)
+ {
+ Fqn nodeFqn = getFqn(ns, NODE_GROUPS_SEARCHES, search.hashCode());
+
+ Node ioNode = getCache().getRoot().addChild(nodeFqn);
+
+ ioNode.put(NODE_OBJECT_KEY, Collections.unmodifiableCollection(results));
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Group search stored in cache: results.size()=" + results.size());
+ }
+ }
+
+ public Collection<Group> getGroupSearch(String ns, GroupSearch search)
+ {
+ Fqn nodeFqn = getFqn(ns, NODE_GROUPS_SEARCHES, search.hashCode());
+
+ Node node = getCache().getRoot().getChild(nodeFqn);
+
+ if (node != null)
+ {
+ Collection<Group> results = (Collection<Group>)node.get(NODE_OBJECT_KEY);
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Group search found in cache: results.size()=" + results.size());
+ }
+
+ return results;
+ }
+
+ return null;
+ }
+
+ public void putRelationshipSearch(String ns, RelationshipSearch search, Boolean result)
+ {
+ Fqn nodeFqn = getFqn(ns, NODE_RELATIONSHIP_SEARCHES, search.hashCode());
+
+ Node ioNode = getCache().getRoot().addChild(nodeFqn);
+
+ ioNode.put(NODE_OBJECT_KEY, result);
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Relationship search stored in cache: result=" + result);
+ }
+ }
+
+ public Boolean getRelationshipSearch(String ns, RelationshipSearch search)
+ {
+ Fqn nodeFqn = getFqn(ns, NODE_RELATIONSHIP_SEARCHES, search.hashCode());
+
+ Node node = getCache().getRoot().getChild(nodeFqn);
+
+ if (node != null)
+ {
+ Boolean result = (Boolean)node.get(NODE_OBJECT_KEY);
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Relationship search found in cache: properties.size()=" + result);
+ }
+
+ return result;
+ }
+
+ return null;
+ }
+
+ public void putRoleSearch(String ns, RoleSearch search, Collection<Role> results)
+ {
+ Fqn nodeFqn = getFqn(ns, NODE_ROLE_SEARCHES, search.hashCode());
+
+ Node ioNode = getCache().getRoot().addChild(nodeFqn);
+
+ ioNode.put(NODE_OBJECT_KEY,Collections.unmodifiableCollection(results));
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Role search stored in cache: results.size()=" + results.size());
+ }
+ }
+
+ public Collection<Role> getRoleSearch(String ns, RoleSearch search)
+ {
+ Fqn nodeFqn = getFqn(ns, NODE_ROLE_SEARCHES, search.hashCode());
+
+ Node node = getCache().getRoot().getChild(nodeFqn);
+
+ if (node != null)
+ {
+ Collection<Role> results = (Collection<Role>)node.get(NODE_OBJECT_KEY);
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Role search found in cache: results.size()=" + results.size());
+ }
+
+ return results;
+ }
+
+ return null;
+ }
+
+ public void putRoleTypeSearch(String ns, RoleTypeSearch search, Collection<RoleType> results)
+ {
+ Fqn nodeFqn = getFqn(ns, NODE_ROLE_TYPE_SEARCHES, search.hashCode());
+
+ Node ioNode = getCache().getRoot().addChild(nodeFqn);
+
+ ioNode.put(NODE_OBJECT_KEY, Collections.unmodifiableCollection(results));
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "RoleType search stored in cache: results.size()=" + results.size());
+ }
+ }
+
+ public Collection<RoleType> getRoleTypeSearch(String ns, RoleTypeSearch search)
+ {
+ Fqn nodeFqn = getFqn(ns, NODE_ROLE_TYPE_SEARCHES, search.hashCode());
+
+ Node node = getCache().getRoot().getChild(nodeFqn);
+
+ if (node != null)
+ {
+ Collection<RoleType> results = (Collection<RoleType>)node.get(NODE_OBJECT_KEY);
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "RoleType search found in cache: results.size()=" + results.size());
+ }
+
+ return results;
+ }
+
+ return null;
+ }
+
+ public void invalidateAllQueries(String ns)
+ {
+ cache.getRoot().removeChild(getFqn(ns, NODE_USERS_QUERIES));
+ cache.getRoot().removeChild(getFqn(ns, NODE_GROUPS_QUERIES));
+ cache.getRoot().removeChild(getFqn(ns, NODE_ROLE_QUERIES));
+
+ }
+
+ public void putUserQuery(String ns, UserQuery q, Collection<User> results)
+ {
+ Fqn nodeFqn = getFqn(ns, NODE_USERS_QUERIES, q.hashCode());
+
+ Node ioNode = getCache().getRoot().addChild(nodeFqn);
+
+ ioNode.put(NODE_QUERY_KEY, results);
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "User query stored in cache: q.hashCode()=" + q.hashCode() + "; results.size()=" + results.size());
+ }
+ }
+
+ public void putUserQueryUnique(String ns, UserQuery q, User user)
+ {
+ Fqn nodeFqn = getFqn(ns, NODE_USERS_QUERIES, q.hashCode());
+
+ Node ioNode = getCache().getRoot().addChild(nodeFqn);
+
+ ioNode.put(NODE_QUERY_UNIQUE_KEY, user);
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "User query stored in cache: q.hashCode()=" + q.hashCode() + "; user=" + user);
+ }
+ }
+
+ public Collection<User> getUserQuery(String ns, UserQuery q)
+ {
+ Fqn nodeFqn = getFqn(ns, NODE_USERS_QUERIES, q.hashCode());
+
+ Node node = getCache().getRoot().getChild(nodeFqn);
+
+ if (node != null)
+ {
+ Collection<User> users = (Collection<User>)node.get(NODE_QUERY_KEY);
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "User query found in cache: users.size()=" + users.size() +
+ "; query.hash()=" + q.hashCode());
+ }
+
+ return users;
+ }
+
+ return null;
+ }
+
+ public User getUserQueryUnique(String ns, UserQuery q)
+ {
+ Fqn nodeFqn = getFqn(ns, NODE_USERS_QUERIES, q.hashCode());
+
+ Node node = getCache().getRoot().getChild(nodeFqn);
+
+ if (node != null)
+ {
+ User users = (User)node.get(NODE_QUERY_UNIQUE_KEY);
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "User query found in cache: user=" + users);
+ }
+
+ return users;
+ }
+
+ return null;
+ }
+
+ public void invalidateUserQueries(String ns)
+ {
+ cache.getRoot().removeChild(getFqn(ns, NODE_USERS_QUERIES));
+ }
+
+ public void putGroupQuery(String ns, GroupQuery q, Collection<Group> results)
+ {
+ Fqn nodeFqn = getFqn(ns, NODE_GROUPS_QUERIES, q.hashCode());
+
+ Node ioNode = getCache().getRoot().addChild(nodeFqn);
+
+ ioNode.put(NODE_QUERY_KEY, Collections.unmodifiableCollection(results));
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Group query stored in cache: q.hashCode()=" + q.hashCode() + "; results.size()=" + results.size());
+ }
+ }
+
+ public void putGroupQueryUnique(String ns, GroupQuery q, Group group)
+ {
+ Fqn nodeFqn = getFqn(ns, NODE_GROUPS_QUERIES, q.hashCode());
+
+ Node ioNode = getCache().getRoot().addChild(nodeFqn);
+
+ ioNode.put(NODE_QUERY_UNIQUE_KEY, group);
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Group query stored in cache: q.hashCode()=" + q.hashCode() + "; group=" + group);
+ }
+ }
+
+ public Collection<Group> getGroupQuery(String ns, GroupQuery q)
+ {
+ Fqn nodeFqn = getFqn(ns, NODE_GROUPS_QUERIES, q.hashCode());
+
+ Node node = getCache().getRoot().getChild(nodeFqn);
+
+ if (node != null)
+ {
+ Collection<Group> groups = (Collection<Group>)node.get(NODE_QUERY_KEY);
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Group query found in cache: groups.size()=" + groups.size() +
+ "; query.hash()=" + q.hashCode());
+ }
+
+ return groups;
+ }
+
+ return null;
+ }
+
+ public Group getGroupQueryUnique(String ns, GroupQuery q)
+ {
+ Fqn nodeFqn = getFqn(ns, NODE_GROUPS_QUERIES, q.hashCode());
+
+ Node node = getCache().getRoot().getChild(nodeFqn);
+
+ if (node != null)
+ {
+ Group group = (Group)node.get(NODE_QUERY_UNIQUE_KEY);
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Group query found in cache: group=" + group);
+ }
+
+ return group;
+ }
+
+ return null;
+ }
+
+ public void invalidateGroupQueries(String ns)
+ {
+ cache.getRoot().removeChild(getFqn(ns, NODE_GROUPS_QUERIES));
+ }
+
+ public void putRoleQuery(String ns, RoleQuery q, Collection<Role> results)
+ {
+ Fqn nodeFqn = getFqn(ns, NODE_ROLE_QUERIES, q.hashCode());
+
+ Node ioNode = getCache().getRoot().addChild(nodeFqn);
+
+ ioNode.put(NODE_QUERY_KEY, results);
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Role query stored in cache: q.hashCode()=" + q.hashCode() + "; results.size()=" + results.size());
+ }
+ }
+ public void putRoleQueryUnique(String ns, RoleQuery q, Role role)
+ {
+ Fqn nodeFqn = getFqn(ns, NODE_ROLE_QUERIES, q.hashCode());
+
+ Node ioNode = getCache().getRoot().addChild(nodeFqn);
+
+ ioNode.put(NODE_QUERY_UNIQUE_KEY, role);
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Role query stored in cache: q.hashCode()=" + q.hashCode() + "; role=" + role);
+ }
+ }
+
+ public Collection<Role> getRoleQuery(String ns, RoleQuery q)
+ {
+ Fqn nodeFqn = getFqn(ns, NODE_ROLE_QUERIES, q.hashCode());
+
+ Node node = getCache().getRoot().getChild(nodeFqn);
+
+ if (node != null)
+ {
+ Collection<Role> roles = (Collection<Role>)node.get(NODE_QUERY_KEY);
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Role query found in cache: users.size()=" + roles.size() +
+ "; query.hash()=" + q.hashCode());
+ }
+
+ return roles;
+ }
+
+ return null;
+ }
+
+ public Role getRoleQueryUnique(String ns, RoleQuery q)
+ {
+ Fqn nodeFqn = getFqn(ns, NODE_ROLE_QUERIES, q.hashCode());
+
+ Node node = getCache().getRoot().getChild(nodeFqn);
+
+ if (node != null)
+ {
+ Role role = (Role)node.get(NODE_QUERY_UNIQUE_KEY);
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Role query found in cache: role=" + role);
+ }
+
+ return role;
+ }
+
+ return null;
+ }
+
+ public void invalidateRoleQueries(String ns)
+ {
+ cache.getRoot().removeChild(getFqn(ns, NODE_ROLE_QUERIES));
+ }
+}
Added: idm/trunk/idm-cache/src/test/java/org/jboss/identity/idm/cache/APICacheProviderTestCase.java
===================================================================
--- idm/trunk/idm-cache/src/test/java/org/jboss/identity/idm/cache/APICacheProviderTestCase.java (rev 0)
+++ idm/trunk/idm-cache/src/test/java/org/jboss/identity/idm/cache/APICacheProviderTestCase.java 2009-11-04 22:30:01 UTC (rev 905)
@@ -0,0 +1,73 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2009, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* 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.identity.idm.cache;
+
+import junit.framework.TestCase;
+
+import java.util.Map;
+import java.util.HashMap;
+
+import org.jboss.identity.idm.impl.cache.JBossCacheAPICacheProviderImpl;
+import org.jboss.identity.idm.impl.api.model.SimpleUser;
+import org.jboss.identity.idm.api.User;
+
+
+public class APICacheProviderTestCase extends TestCase
+{
+
+ public void testSimple() throws Exception
+ {
+ Map<String, String> props = new HashMap<String, String>();
+ props.put(JBossCacheAPICacheProviderImpl.CONFIG_FILE_OPTION, "jboss-cache.xml");
+ APICacheProvider cache = new JBossCacheAPICacheProviderImpl();
+ cache.initialize(props);
+
+ String ns = "toto";
+
+ User u1 = new SimpleUser("u1");
+ User u2 = new SimpleUser("u2");
+ User u3 = new SimpleUser("u3");
+
+ assertNull(cache.getUser(ns, "u1"));
+ assertNull(cache.getUser(ns, "u2"));
+ assertNull(cache.getUser(ns, "u3"));
+
+ cache.putUser(ns, u1);
+ cache.putUser(ns, u3);
+
+ assertNotNull(cache.getUser(ns, "u1"));
+ assertNull(cache.getUser(ns, "u2"));
+ assertNotNull(cache.getUser(ns, "u3"));
+
+ cache.invalidateUsers(ns);
+
+ assertNull(cache.getUser(ns, "u1"));
+ assertNull(cache.getUser(ns, "u2"));
+ assertNull(cache.getUser(ns, "u3"));
+
+
+
+
+ }
+
+}
Added: idm/trunk/idm-cache/src/test/resources/jboss-cache.xml
===================================================================
--- idm/trunk/idm-cache/src/test/resources/jboss-cache.xml (rev 0)
+++ idm/trunk/idm-cache/src/test/resources/jboss-cache.xml 2009-11-04 22:30:01 UTC (rev 905)
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="urn:jboss:jbosscache-core:config:3.0">
+
+</jbosscache>
\ No newline at end of file
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/IdentitySearchCriteriaImpl.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/IdentitySearchCriteriaImpl.java 2009-11-03 14:33:23 UTC (rev 904)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/IdentitySearchCriteriaImpl.java 2009-11-04 22:30:01 UTC (rev 905)
@@ -43,12 +43,13 @@
import java.util.Collections;
import java.util.Comparator;
import java.util.LinkedList;
+import java.io.Serializable;
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
* @version : 0.1 $
*/
-public class IdentitySearchCriteriaImpl implements IdentitySearchCriteria, IdentityObjectSearchCriteria
+public class IdentitySearchCriteriaImpl implements IdentitySearchCriteria, IdentityObjectSearchCriteria, Serializable
{
private boolean sorted = false;
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/IdentitySessionFactoryImpl.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/IdentitySessionFactoryImpl.java 2009-11-03 14:33:23 UTC (rev 904)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/IdentitySessionFactoryImpl.java 2009-11-04 22:30:01 UTC (rev 905)
@@ -77,7 +77,7 @@
IdentitySession newSession =
new IdentitySessionImpl(sessionConfigCtx.getRealmName(),
- sessionConfigCtx.getRepository(), sessionConfigCtx.getTypeMapper());
+ sessionConfigCtx.getRepository(), sessionConfigCtx.getTypeMapper(), sessionConfigCtx.getApiCacheProvider());
realmMap.put(realmName, newSession);
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/model/GroupId.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/model/GroupId.java 2009-11-03 14:33:23 UTC (rev 904)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/model/GroupId.java 2009-11-04 22:30:01 UTC (rev 905)
@@ -84,6 +84,14 @@
return true;
}
+ public static String parseId(String name, String type)
+ {
+ GroupId gid = new GroupId(name, type);
+ String id = gid.getId();
+ gid = null;
+ return id;
+ }
+
public String getName()
{
return name;
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/AbstractQuery.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/AbstractQuery.java 2009-11-03 14:33:23 UTC (rev 904)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/AbstractQuery.java 2009-11-04 22:30:01 UTC (rev 905)
@@ -41,12 +41,13 @@
import java.util.List;
import java.util.LinkedList;
+import java.io.Serializable;
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
* @version : 0.1 $
*/
-public abstract class AbstractQuery implements Query
+public abstract class AbstractQuery implements Query, Serializable
{
protected IdentitySearchCriteriaImpl searchCriteria = new IdentitySearchCriteriaImpl();
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/UserQueryImpl.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/UserQueryImpl.java 2009-11-03 14:33:23 UTC (rev 904)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/UserQueryImpl.java 2009-11-04 22:30:01 UTC (rev 905)
@@ -33,7 +33,7 @@
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
* @version : 0.1 $
*/
-public class UserQueryImpl extends AbstractQuery implements UserQuery
+public class UserQueryImpl extends AbstractQuery implements UserQuery
{
public final String userId;
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/IdentitySessionImpl.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/IdentitySessionImpl.java 2009-11-03 14:33:23 UTC (rev 904)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/IdentitySessionImpl.java 2009-11-04 22:30:01 UTC (rev 905)
@@ -68,6 +68,7 @@
import org.jboss.identity.idm.impl.api.query.UserQueryBuilderImpl;
import org.jboss.identity.idm.impl.api.query.GroupQueryBuilderImpl;
import org.jboss.identity.idm.impl.api.query.RoleQueryBuilderImpl;
+import org.jboss.identity.idm.cache.APICacheProvider;
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
@@ -98,6 +99,10 @@
private final Collection<EventListener> listeners = new LinkedList<EventListener>();
+ private final APICacheProvider apiCacheProvider;
+
+ private final String cacheNS;
+
public IdentitySessionContext getSessionContext()
{
return sessionContext;
@@ -105,7 +110,8 @@
public IdentitySessionImpl(String realmName,
IdentityStoreRepository repository,
- IdentityObjectTypeMapper typeMapper) throws IdentityException
+ IdentityObjectTypeMapper typeMapper,
+ APICacheProvider apiCacheProvider) throws IdentityException
{
this.realmName = realmName;
@@ -129,7 +135,17 @@
this.userQueryExecutor = new UserQueryExecutorImpl(this);
this.groupQueryExecutor = new GroupQueryExecutorImpl(this);
this.roleQueryExecutor = new RoleQueryExecutorImpl(this);
+
+ this.apiCacheProvider = apiCacheProvider;
+ if (apiCacheProvider != null)
+ {
+ cacheNS = apiCacheProvider.getNamespace(realmName);
+ }
+ else
+ {
+ cacheNS = null;
+ }
}
@@ -224,47 +240,192 @@
public Collection<User> execute(UserQuery userQuery) throws QueryException
{
- return userQueryExecutor.execute((UserQueryImpl)userQuery);
+ if (apiCacheProvider != null)
+ {
+ Collection<User> results = apiCacheProvider.getUserQuery(cacheNS, userQuery);
+ if (results != null)
+ {
+ return results;
+ }
+ }
+
+ Collection<User> results = userQueryExecutor.execute((UserQueryImpl)userQuery);
+
+ if (apiCacheProvider != null)
+ {
+ apiCacheProvider.putUserQuery(cacheNS, userQuery, results);
+ }
+
+ return results;
}
public User uniqueResult(UserQuery userQuery) throws QueryException
{
- return userQueryExecutor.uniqueResult((UserQueryImpl)userQuery);
+ if (apiCacheProvider != null)
+ {
+ User result = apiCacheProvider.getUserQueryUnique(cacheNS, userQuery);
+ if (result != null)
+ {
+ return result;
+ }
+ }
+
+ User result = userQueryExecutor.uniqueResult((UserQueryImpl)userQuery);
+
+ if (apiCacheProvider != null)
+ {
+ apiCacheProvider.putUserQueryUnique(cacheNS, userQuery, result);
+ }
+
+ return result;
}
public List<User> list(UserQuery userQuery) throws QueryException
{
- return userQueryExecutor.list((UserQueryImpl)userQuery);
+
+ if (apiCacheProvider != null)
+ {
+ Collection<User> results = apiCacheProvider.getUserQuery(cacheNS, userQuery);
+ if (results != null && results instanceof List)
+ {
+ return (List<User>)results;
+ }
+ }
+
+ List<User> results = userQueryExecutor.list((UserQueryImpl)userQuery);
+
+ if (apiCacheProvider != null)
+ {
+ apiCacheProvider.putUserQuery(cacheNS, userQuery, results);
+ }
+
+ return results;
}
public Collection<Group> execute(GroupQuery groupQuery) throws QueryException
{
- return groupQueryExecutor.execute((GroupQueryImpl)groupQuery);
+ if (apiCacheProvider != null)
+ {
+ Collection<Group> results = apiCacheProvider.getGroupQuery(cacheNS, groupQuery);
+ if (results != null)
+ {
+ return results;
+ }
+ }
+
+ Collection<Group> results = groupQueryExecutor.execute((GroupQueryImpl)groupQuery);
+
+ if (apiCacheProvider != null)
+ {
+ apiCacheProvider.putGroupQuery(cacheNS, groupQuery, results);
+ }
+
+ return results;
}
public Group uniqueResult(GroupQuery groupQuery) throws QueryException
{
- return groupQueryExecutor.uniqueResult((GroupQueryImpl)groupQuery);
+ if (apiCacheProvider != null)
+ {
+ Group result = apiCacheProvider.getGroupQueryUnique(cacheNS, groupQuery);
+ if (result != null)
+ {
+ return result;
+ }
+ }
+
+ Group group = groupQueryExecutor.uniqueResult((GroupQueryImpl)groupQuery);
+
+ if (apiCacheProvider != null)
+ {
+ apiCacheProvider.putGroupQueryUnique(cacheNS, groupQuery, group);
+ }
+
+ return group;
}
public List<Group> list(GroupQuery groupQuery) throws QueryException
{
- return groupQueryExecutor.list((GroupQueryImpl)groupQuery);
+ if (apiCacheProvider != null)
+ {
+ Collection<Group> results = apiCacheProvider.getGroupQuery(cacheNS, groupQuery);
+ if (results != null && results instanceof List)
+ {
+ return (List<Group>)results;
+ }
+ }
+
+ List<Group> results = groupQueryExecutor.list((GroupQueryImpl)groupQuery);
+
+ if (apiCacheProvider != null)
+ {
+ apiCacheProvider.putGroupQuery(cacheNS, groupQuery, results);
+ }
+
+ return results;
}
public Collection<Role> execute(RoleQuery roleQuery) throws QueryException
{
- return roleQueryExecutor.execute((RoleQueryImpl)roleQuery);
+ if (apiCacheProvider != null)
+ {
+ Collection<Role> results = apiCacheProvider.getRoleQuery(cacheNS, roleQuery);
+ if (results != null)
+ {
+ return results;
+ }
+ }
+
+ Collection<Role> results = roleQueryExecutor.execute((RoleQueryImpl)roleQuery);
+
+ if (apiCacheProvider != null)
+ {
+ apiCacheProvider.putRoleQuery(cacheNS, roleQuery, results);
+ }
+
+ return results;
}
public Role uniqueResult(RoleQuery roleQuery) throws QueryException
{
- return roleQueryExecutor.uniqueResult((RoleQueryImpl)roleQuery);
+ if (apiCacheProvider != null)
+ {
+ Role result = apiCacheProvider.getRoleQueryUnique(cacheNS, roleQuery);
+ if (result != null)
+ {
+ return result;
+ }
+ }
+
+ Role result = roleQueryExecutor.uniqueResult((RoleQueryImpl)roleQuery);
+
+ if (apiCacheProvider != null)
+ {
+ apiCacheProvider.putRoleQueryUnique(cacheNS, roleQuery, result);
+ }
+
+ return result;
}
public List<Role> list(RoleQuery roleQuery) throws QueryException
{
- return roleQueryExecutor.list((RoleQueryImpl)roleQuery);
+ if (apiCacheProvider != null)
+ {
+ Collection<Role> results = apiCacheProvider.getRoleQuery(cacheNS, roleQuery);
+ if (results != null && results instanceof List)
+ {
+ return (List<Role>)results;
+ }
+ }
+
+ List<Role> results = roleQueryExecutor.list((RoleQueryImpl)roleQuery);
+
+ if (apiCacheProvider != null)
+ {
+ apiCacheProvider.putRoleQuery(cacheNS, roleQuery, results);
+ }
+
+ return results;
}
public void registerListener(EventListener listener)
@@ -276,4 +437,14 @@
{
return listeners;
}
+
+ public APICacheProvider getApiCacheProvider()
+ {
+ return apiCacheProvider;
+ }
+
+ public String getCacheNS()
+ {
+ return cacheNS;
+ }
}
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AbstractManager.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AbstractManager.java 2009-11-03 14:33:23 UTC (rev 904)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AbstractManager.java 2009-11-04 22:30:01 UTC (rev 905)
@@ -38,6 +38,7 @@
import org.jboss.identity.idm.impl.api.model.GroupId;
import org.jboss.identity.idm.impl.api.SimpleAttribute;
import org.jboss.identity.idm.impl.api.IdentitySearchCriteriaImpl;
+import org.jboss.identity.idm.cache.APICacheProvider;
import java.io.Serializable;
import java.util.Collection;
@@ -52,9 +53,15 @@
{
protected final IdentitySessionImpl identitySession;
+ protected final APICacheProvider cache;
+
+ protected final String cacheNS;
+
protected AbstractManager(IdentitySessionImpl session)
{
this.identitySession = session;
+ this.cache = session.getApiCacheProvider();
+ this.cacheNS = session.getCacheNS();
}
public IdentitySession getIdentitySession()
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AttributesManagerImpl.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AttributesManagerImpl.java 2009-11-03 14:33:23 UTC (rev 904)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AttributesManagerImpl.java 2009-11-04 22:30:01 UTC (rev 905)
@@ -154,6 +154,15 @@
{
checkNotNullArgument(identityType, "IdentityType");
+ if (cache != null)
+ {
+ Map<String, Attribute> attributes = cache.getAttributes(cacheNS, identityType.getId());
+ if (attributes != null)
+ {
+ return attributes;
+ }
+ }
+
Map<String, IdentityObjectAttribute> map = getRepository().getAttributes(getInvocationContext(), createIdentityObject(identityType));
Map<String, Attribute> newMap = new HashMap<String, Attribute>();
@@ -162,6 +171,11 @@
{
newMap.put(entry.getKey(), convertAttribute(entry.getValue()));
}
+
+ if (cache != null)
+ {
+ cache.putAttributes(cacheNS, identityType.getId(), newMap);
+ }
return newMap;
}
@@ -185,6 +199,18 @@
getRepository().updateAttributes(getInvocationContext(), createIdentityObject(identity), convertAttributes(attributes));
+ if (cache != null)
+ {
+ Map<String, Attribute> attrMap = new HashMap<String, Attribute>();
+
+ for (Attribute attribute : attributes)
+ {
+ attrMap.put(attribute.getName(), attribute);
+ }
+
+ cache.putAttributes(cacheNS, identity.getId(), attrMap);
+ }
+
postAttributesUpdate(identity, attributes);
}
@@ -289,6 +315,13 @@
getRepository().addAttributes(getInvocationContext(), createIdentityObject(identityType), convertAttributes(attributes));
+ if (cache != null)
+ {
+ // Grab the new profile and persist in cache
+ cache.invalidateAttributes(cacheNS, identityType.getId());
+ cache.putAttributes(cacheNS, identityType.getId(), this.getAttributes(identityType));
+ }
+
postAttributesAdd(identityType, attributes);
}
@@ -303,6 +336,13 @@
getRepository().removeAttributes(getInvocationContext(), createIdentityObject(identityType), attributeNames);
+ if (cache != null)
+ {
+ // Grab the new profile and persist in cache
+ cache.invalidateAttributes(cacheNS, identityType.getId());
+ cache.putAttributes(cacheNS, identityType.getId(), this.getAttributes(identityType));
+ }
+
postAttributesRemove(identityType, attributeNames);
}
@@ -403,6 +443,8 @@
checkNotNullArgument(attributeName, "Attribute name");
checkNotNullArgument(value, "Attribute value");
+ //TODO: cache
+
IdentityObject io = getRepository().findIdentityObjectByUniqueAttribute(getInvocationContext(), getUserObjectType(), new SimpleAttribute(attributeName, value));
if (io == null)
@@ -419,6 +461,8 @@
checkNotNullArgument(attributeName, "Attribute name");
checkNotNullArgument(value, "Attribute value");
+ //TODO: cache
+
IdentityObject io = getRepository().findIdentityObjectByUniqueAttribute(getInvocationContext(),
getIdentityObjectType(groupType),
new SimpleAttribute(attributeName, value));
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/PersistenceManagerImpl.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/PersistenceManagerImpl.java 2009-11-03 14:33:23 UTC (rev 904)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/PersistenceManagerImpl.java 2009-11-04 22:30:01 UTC (rev 905)
@@ -34,6 +34,7 @@
import org.jboss.identity.idm.impl.api.model.GroupId;
import org.jboss.identity.idm.impl.api.model.SimpleUser;
import org.jboss.identity.idm.impl.api.model.SimpleGroup;
+import org.jboss.identity.idm.impl.cache.GroupSearchImpl;
import java.util.Collection;
import java.util.List;
@@ -126,9 +127,20 @@
IdentityObject identityObject = getRepository().createIdentityObject(getInvocationContext(), identityName, iot);
+ User user = createUser(identityObject);
+
+ //Cache
+ if (cache != null)
+ {
+ //TODO: maybe invalidate only part
+ cache.invalidate(cacheNS);
+ cache.putUser(cacheNS, user);
+ }
+
postCreate(new SimpleUser(identityName));
- return createUser(identityObject);
+
+ return user;
}
public Group createGroup(String groupName, String groupType) throws IdentityException
@@ -144,9 +156,18 @@
IdentityObject identityObject = getRepository().createIdentityObject(getInvocationContext(), groupName, iot);
+ Group group = createGroup(identityObject);
+
+ if (cache != null)
+ {
+ //TODO: maybe invalidate only part
+ cache.invalidate(cacheNS);
+ cache.putGroup(cacheNS, group);
+ }
+
postCreate(new SimpleGroup(groupName, groupType));
- return createGroup(identityObject);
+ return group;
}
public String createGroupId(String groupName, String groupType)
@@ -167,7 +188,15 @@
getRepository().removeIdentityObject(getInvocationContext(), createIdentityObject(user));
+ if (cache != null)
+ {
+ //TODO: maybe invalidate only part
+ cache.invalidate(cacheNS);
+ }
+
postRemove(user);
+
+
}
public void removeUser(String userName, boolean force) throws IdentityException
@@ -178,6 +207,12 @@
getRepository().removeIdentityObject(getInvocationContext(), createIdentityObjectForUserName(userName));
+ if (cache != null)
+ {
+ //TODO: maybe invalidate only part
+ cache.invalidate(cacheNS);
+ }
+
postRemove(new SimpleUser(userName));
}
@@ -192,6 +227,11 @@
getRepository().removeIdentityObject(getInvocationContext(), createIdentityObject(group));
+ if (cache != null)
+ {
+ cache.invalidate(cacheNS);
+ }
+
postRemove(group);
}
@@ -205,35 +245,88 @@
getRepository().removeIdentityObject(getInvocationContext(), createIdentityObjectForGroupId(groupId));
+ if (cache != null)
+ {
+ cache.invalidate(cacheNS);
+ }
+
postRemove(new SimpleGroup(new GroupId(groupId)));
}
public int getUserCount() throws IdentityException
{
+ if (cache != null)
+ {
+ int count = cache.getUserCount(cacheNS);
+ if (count != -1)
+ {
+ return count;
+ }
+ }
+
IdentityObjectType iot = getUserObjectType();
- return getRepository().getIdentityObjectsCount(getInvocationContext(), iot);
+ int count = getRepository().getIdentityObjectsCount(getInvocationContext(), iot);
+
+ if (cache != null)
+ {
+ cache.putUserCount(cacheNS, count);
+ }
+
+ return count;
}
public int getGroupTypeCount(String groupType) throws IdentityException
{
checkNotNullArgument(groupType, "Group type");
+ if (cache != null)
+ {
+ int count = cache.getGroupCount(cacheNS, groupType);
+ if (count != -1)
+ {
+ return count;
+ }
+ }
+
IdentityObjectType iot = getIdentityObjectType(groupType);
- return getRepository().getIdentityObjectsCount(getInvocationContext(), iot);
+ int count = getRepository().getIdentityObjectsCount(getInvocationContext(), iot);
+
+ if (cache != null)
+ {
+ cache.putGroupCount(cacheNS, groupType, count);
+ }
+
+ return count;
}
public User findUser(String name) throws IdentityException
{
checkNotNullArgument(name, "User name");
+ if (cache != null)
+ {
+ User user = cache.getUser(cacheNS, name);
+ if (user != null)
+ {
+ return user;
+ }
+ }
+
IdentityObject io = getRepository().findIdentityObject(getInvocationContext(), name, getUserObjectType());
if (io != null)
{
- return createUser(io);
+ User user = createUser(io);
+
+ if (cache != null)
+ {
+ cache.putUser(cacheNS, user);
+ }
+
+ return user;
}
return null;
}
@@ -241,7 +334,16 @@
public Collection<User> findUser(IdentitySearchCriteria criteria) throws IdentityException
{
+ if (cache != null)
+ {
+ Collection<User> users = cache.getUsers(cacheNS, criteria);
+ if (users != null)
+ {
+ return users;
+ }
+ }
+
Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), getUserObjectType(), convertSearchControls(criteria));
List<User> identities = new LinkedList<User>();
@@ -251,6 +353,12 @@
identities.add(createUser(identityObject));
}
+
+ if (cache != null)
+ {
+ cache.putUsers(cacheNS, criteria, identities);
+ }
+
return identities;
}
@@ -259,11 +367,27 @@
checkNotNullArgument(name, "Group name");
checkNotNullArgument(groupType, "Group type");
+ if (cache != null)
+ {
+ Group group = cache.getGroup(cacheNS, groupType, name);
+ if (group != null)
+ {
+ return group;
+ }
+ }
+
IdentityObject io = getRepository().findIdentityObject(getInvocationContext(), name, getIdentityObjectType(groupType));
if (io != null)
{
- return createGroup(io);
+ Group group = createGroup(io);
+
+ if (cache != null)
+ {
+ cache.putGroup(cacheNS, group);
+ }
+
+ return group;
}
return null;
}
@@ -288,6 +412,19 @@
{
checkNotNullArgument(groupType, "Group type");
+ if (cache != null)
+ {
+ GroupSearchImpl search = new GroupSearchImpl();
+ search.setGroupType(groupType);
+ search.setSearchCriteria(criteria);
+
+ Collection<Group> results = cache.getGroupSearch(cacheNS, search);
+ if (results != null)
+ {
+ return results;
+ }
+ }
+
Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), getIdentityObjectType(groupType), convertSearchControls(criteria));
List<Group> groups = new LinkedList<Group>();
@@ -297,6 +434,16 @@
groups.add(createGroup(identityObject));
}
+ if (cache != null)
+ {
+ GroupSearchImpl search = new GroupSearchImpl();
+ search.setGroupType(groupType);
+ search.setSearchCriteria(criteria);
+
+ cache.putGroupSearch(cacheNS, search, groups);
+
+ }
+
return groups;
}
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RelationshipManagerImpl.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RelationshipManagerImpl.java 2009-11-03 14:33:23 UTC (rev 904)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RelationshipManagerImpl.java 2009-11-04 22:30:01 UTC (rev 905)
@@ -42,6 +42,10 @@
import org.jboss.identity.idm.impl.api.model.SimpleGroup;
import org.jboss.identity.idm.impl.api.model.GroupId;
import org.jboss.identity.idm.impl.api.model.SimpleUser;
+import org.jboss.identity.idm.impl.cache.RelationshipSearchImpl;
+import org.jboss.identity.idm.impl.cache.GroupSearchImpl;
+import org.jboss.identity.idm.impl.cache.UserSearchImpl;
+import org.jboss.identity.idm.cache.RelationshipSearch;
import java.util.Collection;
import java.util.Iterator;
@@ -209,6 +213,12 @@
getRepository().createRelationship(getInvocationContext(), createIdentityObject(parent), createIdentityObject(member), MEMBER, null, true);
+ if (cache != null)
+ {
+ cache.invalidateAllQueries(cacheNS);
+ cache.invalidateAllSearches(cacheNS);
+ }
+
postGroupAssociationCreate(parent, member);
}
@@ -227,6 +237,13 @@
getRepository().createRelationship(getInvocationContext(), createIdentityObjectForGroupId(parentId), createIdentityObjectForGroupId(memberId), MEMBER, null, true);
+ if (cache != null)
+ {
+ cache.invalidateAllQueries(cacheNS);
+ cache.invalidateAllSearches(cacheNS);
+ }
+
+
postGroupAssociationCreate(parent, member);
}
@@ -294,6 +311,13 @@
getRepository().createRelationship(getInvocationContext(), createIdentityObject(parent), createIdentityObject(member), MEMBER, null, true);
+ if (cache != null)
+ {
+ cache.invalidateAllQueries(cacheNS);
+ cache.invalidateAllSearches(cacheNS);
+ }
+
+
postUserAssociationCreate(parent, member);
}
@@ -311,6 +335,13 @@
getRepository().createRelationship(getInvocationContext(), createIdentityObjectForGroupId(parentId), createIdentityObjectForUserName(memberId), MEMBER, null, true);
+ if (cache != null)
+ {
+ cache.invalidateAllQueries(cacheNS);
+ cache.invalidateAllSearches(cacheNS);
+ }
+
+
postUserAssociationCreate(parent, member);
}
@@ -353,6 +384,12 @@
getRepository().removeRelationship(getInvocationContext(), createIdentityObject(parent), createIdentityObject(member), MEMBER, null);
+ if (cache != null)
+ {
+ cache.invalidateAllQueries(cacheNS);
+ cache.invalidateAllSearches(cacheNS);
+ }
+
postGroupAssociationRemove(parent, member);
}
@@ -388,6 +425,13 @@
getRepository().removeRelationship(getInvocationContext(), createIdentityObjectForGroupId(parent), createIdentityObjectForGroupId(member), MEMBER, null);
+ if (cache != null)
+ {
+ cache.invalidateAllQueries(cacheNS);
+ cache.invalidateAllSearches(cacheNS);
+ }
+
+
postGroupAssociationRemove(parentGroup, memberGroup);
}
@@ -418,6 +462,13 @@
getRepository().removeRelationship(getInvocationContext(), createIdentityObject(parent), createIdentityObject(member), MEMBER, null);
+ if (cache != null)
+ {
+ cache.invalidateAllQueries(cacheNS);
+ cache.invalidateAllSearches(cacheNS);
+ }
+
+
postUserAssociationRemove(parent, member);
}
}
@@ -452,6 +503,13 @@
getRepository().removeRelationship(getInvocationContext(), createIdentityObjectForGroupId(parent), createIdentityObjectForUserName(member), MEMBER, null);
+ if (cache != null)
+ {
+ cache.invalidateAllQueries(cacheNS);
+ cache.invalidateAllSearches(cacheNS);
+ }
+
+
postUserAssociationRemove(parentGroup, memberUser);
}
@@ -473,7 +531,27 @@
checkNotNullArgument(parents, "parents");
checkNotNullArgument(members, "members");
+ if (cache != null)
+ {
+ RelationshipSearchImpl search = new RelationshipSearchImpl();
+ for (G parent : parents)
+ {
+ search.addParent(parent);
+ }
+ for (I member : members)
+ {
+ search.addMember(member);
+ }
+ Boolean result = cache.getRelationshipSearch(cacheNS, search);
+
+ if (result != null)
+ {
+ return result;
+ }
+ }
+
+
for (Iterator<G> parentsIterator = parents.iterator(); parentsIterator.hasNext();)
{
IdentityType parent = parentsIterator.next();
@@ -486,11 +564,41 @@
if (relationships.size() == 0)
{
+ if (cache != null)
+ {
+ RelationshipSearchImpl search = new RelationshipSearchImpl();
+ for (G p : parents)
+ {
+ search.addParent(p);
+ }
+ for (I m : members)
+ {
+ search.addMember(m);
+ }
+ cache.putRelationshipSearch(cacheNS, search, false);
+
+ }
+
return false;
}
}
}
+ if (cache != null)
+ {
+ RelationshipSearchImpl search = new RelationshipSearchImpl();
+ for (G p : parents)
+ {
+ search.addParent(p);
+ }
+ for (I m : members)
+ {
+ search.addMember(m);
+ }
+ cache.putRelationshipSearch(cacheNS, search, true);
+
+ }
+
return true;
}
@@ -499,7 +607,26 @@
checkNotNullArgument(parents, "parents");
checkNotNullArgument(members, "members");
+ if (cache != null)
+ {
+ RelationshipSearchImpl search = new RelationshipSearchImpl();
+ for (String parent : parents)
+ {
+ search.addParent(parent);
+ }
+ for (String member : members)
+ {
+ search.addMember(member);
+ }
+ Boolean result = cache.getRelationshipSearch(cacheNS, search);
+
+ if (result != null)
+ {
+ return result;
+ }
+ }
+
for (Iterator<String> parentsIterator = parents.iterator(); parentsIterator.hasNext();)
{
String parent = parentsIterator.next();
@@ -512,10 +639,41 @@
if (relationships.size() == 0)
{
+ if (cache != null)
+ {
+ RelationshipSearchImpl search = new RelationshipSearchImpl();
+ for (String p : parents)
+ {
+ search.addParent(p);
+ }
+ for (String m : members)
+ {
+ search.addMember(m);
+ }
+ cache.putRelationshipSearch(cacheNS, search, false);
+
+ }
+
return false;
}
}
}
+
+ if (cache != null)
+ {
+ RelationshipSearchImpl search = new RelationshipSearchImpl();
+ for (String p : parents)
+ {
+ search.addParent(p);
+ }
+ for (String m : members)
+ {
+ search.addMember(m);
+ }
+ cache.putRelationshipSearch(cacheNS, search, true);
+
+ }
+
return true;
}
@@ -538,15 +696,38 @@
checkNotNullArgument(parent, "Parent Id");
checkNotNullArgument(member, "Member Id");
+ if (cache != null)
+ {
+ RelationshipSearchImpl search = new RelationshipSearchImpl();
+ search.addParent(parent);
+ search.addMember(member);
+ Boolean result = cache.getRelationshipSearch(cacheNS, search);
+
+ if (result != null)
+ {
+ return result;
+ }
+ }
+
Collection<IdentityObjectRelationship> relationships = getRepository().resolveRelationships(getInvocationContext(), createIdentityObject(parent), createIdentityObject(member), MEMBER);
+ boolean result = true;
+
if (relationships.size() == 0)
{
- return false;
+ result = false;
}
- return true;
+ if (cache != null)
+ {
+ RelationshipSearchImpl search = new RelationshipSearchImpl();
+ search.addParent(parent);
+ search.addMember(member);
+ cache.putRelationshipSearch(cacheNS, search, result);
+ }
+
+ return result;
}
private Collection<Group> findAssociatedGroupsCascaded(Collection<Group> previous, Group group, String groupType, boolean parent, IdentitySearchCriteria criteria) throws IdentityException
@@ -575,8 +756,23 @@
{
checkNotNullArgument(group, "Group");
-// checkNotNullArgument(groupType, "Group type");
+ if (cache != null)
+ {
+ GroupSearchImpl search = new GroupSearchImpl();
+ search.addAssociatedGroupId(group.getId());
+ search.setGroupType(groupType);
+ search.setParent(parent);
+ search.setCascade(cascade);
+ search.setSearchCriteria(criteria);
+
+ Collection<Group> results = cache.getGroupSearch(cacheNS, search);
+ if (results != null)
+ {
+ return results;
+ }
+ }
+
List<Group> identities = new LinkedList<Group>();
IdentityObjectType iot = groupType != null ? getIdentityObjectType(groupType) : null;
@@ -602,20 +798,36 @@
throw new IdentityException("Failed to apply criteria", e);
}
- return identities;
+
}
+ else
+ {
- Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(group), MEMBER, parent, convertSearchControls(criteria));
+ Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(group), MEMBER, parent, convertSearchControls(criteria));
- for (IdentityObject io : ios)
- {
- if ((iot == null && !io.getIdentityType().getName().equals(getUserObjectType().getName())) ||
- (iot != null && io.getIdentityType().getName().equals(iot.getName())))
+ for (IdentityObject io : ios)
{
- identities.add(createGroup(io));
+ if ((iot == null && !io.getIdentityType().getName().equals(getUserObjectType().getName())) ||
+ (iot != null && io.getIdentityType().getName().equals(iot.getName())))
+ {
+ identities.add(createGroup(io));
+ }
}
}
+ if (cache != null)
+ {
+ GroupSearchImpl search = new GroupSearchImpl();
+ search.addAssociatedGroupId(group.getId());
+ search.setGroupType(groupType);
+ search.setParent(parent);
+ search.setCascade(cascade);
+ search.setSearchCriteria(criteria);
+
+ cache.putGroupSearch(cacheNS, search, identities);
+
+ }
+
return identities;
}
@@ -643,6 +855,20 @@
checkNotNullArgument(user, "User");
//checkNotNullArgument(groupType, "Group type");
+ if (cache != null)
+ {
+ GroupSearchImpl search = new GroupSearchImpl();
+ search.addAssociatedUserId(user.getId());
+ search.setGroupType(groupType);
+ search.setSearchCriteria(criteria);
+
+ Collection<Group> results = cache.getGroupSearch(cacheNS, search);
+ if (results != null)
+ {
+ return results;
+ }
+ }
+
List<Group> identities = new LinkedList<Group>();
IdentityObjectType iot = groupType != null ? getIdentityObjectType(groupType) : null;
@@ -657,6 +883,19 @@
}
}
+ if (cache != null)
+ {
+ GroupSearchImpl search = new GroupSearchImpl();
+ search.addAssociatedUserId(user.getId());
+ search.setGroupType(groupType);
+ search.setSearchCriteria(criteria);
+
+ cache.putGroupSearch(cacheNS, search, identities);
+
+ }
+
+
+
return identities;
}
@@ -682,6 +921,19 @@
{
checkNotNullArgument(user, "User");
+ if (cache != null)
+ {
+ GroupSearchImpl search = new GroupSearchImpl();
+ search.addAssociatedUserId(user.getId());
+ search.setSearchCriteria(criteria);
+
+ Collection<Group> results = cache.getGroupSearch(cacheNS, search);
+ if (results != null)
+ {
+ return results;
+ }
+ }
+
List<Group> identities = new LinkedList<Group>();
Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(user), MEMBER, false, convertSearchControls(criteria));
@@ -697,6 +949,15 @@
identities.add(createGroup(io));
}
+ if (cache != null)
+ {
+ GroupSearchImpl search = new GroupSearchImpl();
+ search.addAssociatedUserId(user.getId());
+ search.setSearchCriteria(criteria);
+
+ cache.putGroupSearch(cacheNS, search, identities);
+ }
+
return identities;
}
@@ -720,6 +981,20 @@
{
checkNotNullArgument(group, "Group");
+ if (cache != null)
+ {
+ UserSearchImpl search = new UserSearchImpl();
+ search.addAssociatedGroupId(group.getId());
+ search.setCascade(cascade);
+ search.setSearchCriteria(criteria);
+
+ Collection<User> results = cache.getUserSearch(cacheNS, search);
+ if (results != null)
+ {
+ return results;
+ }
+ }
+
List<User> identities = new LinkedList<User>();
if (cascade)
@@ -751,23 +1026,34 @@
throw new IdentityException("Failed to apply criteria", e);
}
- return identities;
-
}
+ else
+ {
- Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(group), MEMBER, true, convertSearchControls(criteria));
+ Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(group), MEMBER, true, convertSearchControls(criteria));
- String userTypeName = getUserObjectType().getName();
+ String userTypeName = getUserObjectType().getName();
- for (IdentityObject io : ios)
- {
- //Filter out groups
- if (io.getIdentityType().getName().equals(userTypeName))
+ for (IdentityObject io : ios)
{
- identities.add(createUser(io));
+ //Filter out groups
+ if (io.getIdentityType().getName().equals(userTypeName))
+ {
+ identities.add(createUser(io));
+ }
}
}
+ if (cache != null)
+ {
+ UserSearchImpl search = new UserSearchImpl();
+ search.addAssociatedGroupId(group.getId());
+ search.setCascade(cascade);
+ search.setSearchCriteria(criteria);
+
+ cache.putUserSearch(cacheNS, search, identities);
+ }
+
return identities;
}
@@ -791,6 +1077,20 @@
{
checkNotNullArgument(user, "User");
+ if (cache != null)
+ {
+ GroupSearchImpl search = new GroupSearchImpl();
+ search.addRelatedUserId(user.getId());
+ search.setGroupType(groupType);
+ search.setSearchCriteria(criteria);
+
+ Collection<Group> results = cache.getGroupSearch(cacheNS, search);
+ if (results != null)
+ {
+ return results;
+ }
+ }
+
List<Group> identities = new LinkedList<Group>();
Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(user), null, false, convertSearchControls(criteria));
@@ -805,6 +1105,20 @@
identities.add(createGroup(io));
}
+ if (cache != null)
+ {
+ GroupSearchImpl search = new GroupSearchImpl();
+ search.addRelatedUserId(user.getId());
+ search.setGroupType(groupType);
+ search.setSearchCriteria(criteria);
+
+ Collection<Group> results = cache.getGroupSearch(cacheNS, search);
+ if (results != null)
+ {
+ return results;
+ }
+ }
+
return identities;
}
@@ -821,6 +1135,19 @@
{
checkNotNullArgument(group, "Group");
+ if (cache != null)
+ {
+ UserSearchImpl search = new UserSearchImpl();
+ search.addRelatedGroupId(group.getId());
+ search.setSearchCriteria(criteria);
+
+ Collection<User> results = cache.getUserSearch(cacheNS, search);
+ if (results != null)
+ {
+ return results;
+ }
+ }
+
List<User> identities = new LinkedList<User>();
Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(group), null, true, convertSearchControls(criteria));
@@ -840,6 +1167,16 @@
}
}
+ if (cache != null)
+ {
+ UserSearchImpl search = new UserSearchImpl();
+ search.addRelatedGroupId(group.getId());
+ search.setSearchCriteria(criteria);
+
+ cache.putUserSearch(cacheNS, search, identities);
+
+ }
+
return identities;
}
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RoleManagerImpl.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RoleManagerImpl.java 2009-11-03 14:33:23 UTC (rev 904)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RoleManagerImpl.java 2009-11-04 22:30:01 UTC (rev 905)
@@ -32,6 +32,7 @@
import org.jboss.identity.idm.api.RoleManagerFeaturesDescription;
import org.jboss.identity.idm.api.IdentitySearchCriteria;
import org.jboss.identity.idm.api.IdentitySearchCriteriumType;
+import org.jboss.identity.idm.api.query.RoleQuery;
import org.jboss.identity.idm.common.exception.IdentityException;
import org.jboss.identity.idm.spi.model.IdentityObjectRelationshipType;
import org.jboss.identity.idm.spi.model.IdentityObjectRelationship;
@@ -43,6 +44,11 @@
import org.jboss.identity.idm.impl.api.model.SimpleRole;
import org.jboss.identity.idm.impl.api.session.IdentitySessionImpl;
import org.jboss.identity.idm.impl.types.SimpleIdentityObjectRelationship;
+import org.jboss.identity.idm.impl.cache.RoleTypeSearchImpl;
+import org.jboss.identity.idm.impl.cache.UserSearchImpl;
+import org.jboss.identity.idm.impl.cache.GroupSearchImpl;
+import org.jboss.identity.idm.impl.cache.RoleSearchImpl;
+import org.jboss.identity.idm.cache.RoleTypeSearch;
import java.util.Collection;
import java.util.Set;
@@ -134,7 +140,17 @@
throw new IdentityException("Role management not supported");
}
- return new SimpleRoleType(roleType);
+ RoleType result = new SimpleRoleType(roleType);
+
+ if (cache != null)
+ {
+ cache.invalidateAllQueries(cacheNS);
+ cache.invalidateAllSearches(cacheNS);
+ cache.putRoleType(cacheNS, result);
+ }
+
+ return result;
+
}
public void removeRoleType(String name) throws IdentityException
@@ -147,6 +163,13 @@
getRepository().removeRelationshipName(getInvocationContext(), name);
+ if (cache != null)
+ {
+ cache.invalidateAllQueries(cacheNS);
+ cache.invalidateAllSearches(cacheNS);
+ cache.removeRoleType(cacheNS, new SimpleRoleType(name));
+ }
+
postRemove(new SimpleRoleType(name));
}
@@ -167,11 +190,26 @@
{
checkNotNullArgument(name, "RoleType name");
+
+ if (cache != null)
+ {
+ RoleType roleType = cache.getRoleType(cacheNS, new SimpleRoleType(name));
+ if (roleType != null)
+ {
+ return roleType;
+ }
+ }
+
try
{
Set<String> names = getRepository().getRelationshipNames(getInvocationContext(), null);
if (names.contains(name))
{
+ if (cache != null)
+ {
+ cache.putRoleType(cacheNS, new SimpleRoleType(name));
+ }
+
return new SimpleRoleType(name);
}
}
@@ -185,7 +223,17 @@
public Collection<RoleType> findRoleTypes(IdentitySearchCriteria criteria) throws IdentityException
{
+ if (cache != null)
+ {
+ RoleTypeSearch search = new RoleTypeSearchImpl();
+ search.setSearchCriteria(criteria);
+ Collection<RoleType> result = cache.getRoleTypeSearch(cacheNS, search);
+ if (result != null)
+ {
+ return result;
+ }
+ }
try
{
@@ -197,6 +245,15 @@
types.add(new SimpleRoleType(name));
}
+ if (cache != null)
+ {
+ RoleTypeSearch search = new RoleTypeSearchImpl();
+ search.setSearchCriteria(criteria);
+
+ cache.putRoleTypeSearch(cacheNS, search, types);
+
+ }
+
return types;
}
catch (OperationNotSupportedException e)
@@ -218,18 +275,25 @@
checkNotNullArgument(group, "Group");
//TODO: add createRoleType switch to the API
-
Role _role = new SimpleRole(roleType, user, group);
preCreate(_role);
IdentityObjectRelationship rel = getRepository().createRelationship(getInvocationContext(), createIdentityObject(group), createIdentityObject(user), ROLE, roleType.getName(), false);
+ Role role = new SimpleRole(new SimpleRoleType(rel.getName()), createUser(rel.getToIdentityObject()), createGroup(rel.getFromIdentityObject()));
+
+ if (cache != null)
+ {
+ cache.invalidateAllQueries(cacheNS);
+ cache.invalidateAllSearches(cacheNS);
+ cache.putRole(cacheNS, role);
+ }
+
postCreate(_role);
-
- //TODO: null id - IdentityObjectRelationship doesn't have id
- return new SimpleRole(new SimpleRoleType(rel.getName()), createUser(rel.getToIdentityObject()), createGroup(rel.getFromIdentityObject()));
+ return role;
+
}
public Role createRole(String roleTypeName, String userName, String groupId) throws IdentityException
@@ -256,6 +320,13 @@
getRepository().removeRelationship(getInvocationContext(), createIdentityObject(group), createIdentityObject(user), ROLE, roleType.getName());
+ if (cache != null)
+ {
+ cache.invalidateAllQueries(cacheNS);
+ cache.invalidateAllSearches(cacheNS);
+ cache.removeRole(cacheNS, _role);
+ }
+
postRemove(_role);
}
@@ -279,6 +350,13 @@
getRepository().removeRelationship(getInvocationContext(), createIdentityObject(role.getGroup()), createIdentityObject(role.getUser()), ROLE, role.getRoleType().getName());
+ if (cache != null)
+ {
+ cache.invalidateAllQueries(cacheNS);
+ cache.invalidateAllSearches(cacheNS);
+ cache.removeRole(cacheNS, role);
+ }
+
postRemove(role);
}
@@ -288,6 +366,16 @@
checkNotNullArgument(user, "User");
checkNotNullArgument(group, "Group");
+ if (cache != null)
+ {
+ Role role = new SimpleRole(roleType, user, group);
+ role = cache.getRole(cacheNS, role);
+ if (role != null)
+ {
+ return true;
+ }
+ }
+
//TODO: does separate hasRelationship method in IdentityStore makes sense?
Set<IdentityObjectRelationship> rels = getRepository().resolveRelationships(getInvocationContext(), createIdentityObject(group), createIdentityObject(user), ROLE);
@@ -296,6 +384,12 @@
{
if (rel.getType().getName().equals(ROLE.getName()) && rel.getName() != null && rel.getName().equals(roleType.getName()))
{
+ if (cache != null)
+ {
+ Role role = new SimpleRole(roleType, user, group);
+ cache.putRole(cacheNS, role);
+ }
+
return true;
}
}
@@ -321,6 +415,16 @@
checkNotNullArgument(user, "User");
checkNotNullArgument(group, "Group");
+ if (cache != null)
+ {
+ Role role = new SimpleRole(roleType, user, group);
+ role = cache.getRole(cacheNS, role);
+ if (role != null)
+ {
+ return role;
+ }
+ }
+
//TODO: does separate hasRelationship method in IdentityStore makes sense?
Set<IdentityObjectRelationship> rels = getRepository().resolveRelationships(getInvocationContext(), createIdentityObject(group), createIdentityObject(user), ROLE);
@@ -334,9 +438,17 @@
{
if (roleType.getName().equals(relationship.getName()))
{
- return new SimpleRole(new SimpleRoleType(relationship.getName()),
+
+ Role role = new SimpleRole(new SimpleRoleType(relationship.getName()),
createUser(relationship.getToIdentityObject()),
createGroup(relationship.getFromIdentityObject()));
+
+ if (cache != null)
+ {
+ cache.putRole(cacheNS, role);
+ }
+
+ return role;
}
}
@@ -374,6 +486,20 @@
checkNotNullArgument(user, "User");
checkNotNullArgument(group, "Group");
+ if (cache != null)
+ {
+ RoleTypeSearchImpl search = new RoleTypeSearchImpl();
+ search.setUser(user);
+ search.setGroup(group);
+ search.setSearchCriteria(criteria);
+
+ Collection<RoleType> results = cache.getRoleTypeSearch(cacheNS, search);
+ if (results != null)
+ {
+ return results;
+ }
+ }
+
Set<IdentityObjectRelationship> rels = getRepository().resolveRelationships(getInvocationContext(), createIdentityObject(group), createIdentityObject(user), ROLE);
Set<RoleType> types = new HashSet<RoleType>();
@@ -382,6 +508,17 @@
types.add(new SimpleRoleType(rel.getName()));
}
+ if (cache != null)
+ {
+ RoleTypeSearchImpl search = new RoleTypeSearchImpl();
+ search.setUser(user);
+ search.setGroup(group);
+ search.setSearchCriteria(criteria);
+
+ cache.putRoleTypeSearch(cacheNS, search, types);
+
+ }
+
return types;
@@ -411,6 +548,19 @@
Set<RoleType> types = new HashSet<RoleType>();
+ if (cache != null)
+ {
+ RoleTypeSearchImpl search = new RoleTypeSearchImpl();
+ search.setUser(user);
+ search.setSearchCriteria(criteria);
+
+ Collection<RoleType> results = cache.getRoleTypeSearch(cacheNS, search);
+ if (results != null)
+ {
+ return results;
+ }
+ }
+
try
{
Collection<String> names = getRepository().getRelationshipNames(getInvocationContext(), createIdentityObject(user), convertSearchControls(criteria));
@@ -420,6 +570,15 @@
types.add(new SimpleRoleType(name));
}
+ if (cache != null)
+ {
+ RoleTypeSearchImpl search = new RoleTypeSearchImpl();
+ search.setUser(user);
+ search.setSearchCriteria(criteria);
+
+ cache.putRoleTypeSearch(cacheNS, search, types);
+ }
+
return types;
}
@@ -442,7 +601,6 @@
public Collection<RoleType> findGroupRoleTypes(Group group) throws IdentityException
{
checkNotNullArgument(group, "Group");
-
return findGroupRoleTypes(group, null);
}
@@ -461,6 +619,19 @@
Set<RoleType> types = new HashSet<RoleType>();
+ if (cache != null)
+ {
+ RoleTypeSearchImpl search = new RoleTypeSearchImpl();
+ search.setGroup(group);
+ search.setSearchCriteria(criteria);
+
+ Collection<RoleType> results = cache.getRoleTypeSearch(cacheNS, search);
+ if (results != null)
+ {
+ return results;
+ }
+ }
+
try
{
Collection<String> names = getRepository().getRelationshipNames(getInvocationContext(), createIdentityObject(group), convertSearchControls(criteria));
@@ -470,6 +641,16 @@
types.add(new SimpleRoleType(name));
}
+ if (cache != null)
+ {
+ RoleTypeSearchImpl search = new RoleTypeSearchImpl();
+ search.setGroup(group);
+ search.setSearchCriteria(criteria);
+
+ cache.putRoleTypeSearch(cacheNS, search, types);
+
+ }
+
return types;
}
@@ -486,7 +667,19 @@
List<User> identities = new LinkedList<User>();
+ if (cache != null)
+ {
+ UserSearchImpl search = new UserSearchImpl();
+ search.addRelatedGroupId(group.getId());
+ search.setSearchCriteria(criteria);
+ Collection<User> results = cache.getUserSearch(cacheNS, search);
+ if (results != null)
+ {
+ return results;
+ }
+ }
+
Collection<IdentityObject> ios = null;
ios = getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(group), ROLE, true, convertSearchControls(criteria));
@@ -496,6 +689,16 @@
identities.add(createUser(io));
}
+ if (cache != null)
+ {
+ UserSearchImpl search = new UserSearchImpl();
+ search.addRelatedGroupId(group.getId());
+ search.setSearchCriteria(criteria);
+
+ cache.putUserSearch(cacheNS, search, identities);
+
+ }
+
return identities;
}
@@ -514,17 +717,38 @@
List<Group> identities = new LinkedList<Group>();
+ if (cache != null)
+ {
+ GroupSearchImpl search = new GroupSearchImpl();
+ search.addRelatedUserId(user.getId());
+ search.setSearchCriteria(criteria);
+ Collection<Group> results = cache.getGroupSearch(cacheNS, search);
+ if (results != null)
+ {
+ return results;
+ }
+ }
+
Collection<IdentityObject> ios = null;
ios = getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(user), ROLE, false, convertSearchControls(criteria));
for (IdentityObject io : ios)
{
-
identities.add(createGroup(io));
}
+ if (cache != null)
+ {
+ GroupSearchImpl search = new GroupSearchImpl();
+ search.addRelatedUserId(user.getId());
+ search.setSearchCriteria(criteria);
+
+ cache.putGroupSearch(cacheNS, search, identities);
+
+ }
+
return identities;
}
@@ -544,6 +768,20 @@
List<Group> identities = new LinkedList<Group>();
+ if (cache != null)
+ {
+ GroupSearchImpl search = new GroupSearchImpl();
+ search.addRelatedUserId(user.getId());
+ search.setGroupType(groupType);
+ search.setSearchCriteria(criteria);
+
+ Collection<Group> results = cache.getGroupSearch(cacheNS, search);
+ if (results != null)
+ {
+ return results;
+ }
+ }
+
Collection<IdentityObject> ios = null;
ios = getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(user), ROLE, false, convertSearchControls(criteria));
@@ -568,7 +806,18 @@
}
}
+ if (cache != null)
+ {
+ GroupSearchImpl search = new GroupSearchImpl();
+ search.addRelatedUserId(user.getId());
+ search.setGroupType(groupType);
+ search.setSearchCriteria(criteria);
+ cache.putGroupSearch(cacheNS, search, identities);
+
+ }
+
+
return identities;
}
@@ -590,6 +839,19 @@
Set<Role> roles = new HashSet<Role>();
+ if (cache != null)
+ {
+ RoleSearchImpl search = new RoleSearchImpl();
+ search.setIdentityTypeId(identityType.getId());
+ search.setRoleType(roleType);
+
+ Collection<Role> results = cache.getRoleSearch(cacheNS, search);
+ if (results != null)
+ {
+ return results;
+ }
+ }
+
Set<IdentityObjectRelationship> relationships = null;
// If Identity then search for parent relationships
@@ -618,6 +880,16 @@
}
}
+ if (cache != null)
+ {
+ RoleSearchImpl search = new RoleSearchImpl();
+ search.setIdentityTypeId(identityType.getId());
+ search.setRoleType(roleType);
+
+ cache.putRoleSearch(cacheNS, search, roles);
+
+ }
+
return roles;
}
@@ -625,7 +897,6 @@
public Collection<Role> findRoles(String id, String roleTypeName) throws IdentityException
{
checkNotNullArgument(id, "Group id or User name");
-// checkNotNullArgument(roleTypeName, "RoleType name");
RoleType roleType = roleTypeName != null ? new SimpleRoleType(roleTypeName) : null;
return findRoles(createIdentityTypeFromId(id), roleType);
@@ -634,8 +905,24 @@
public Map<String, String> getProperties(RoleType roleType) throws IdentityException
{
checkNotNullArgument(roleType, "RoleType name");
+
+ if (cache != null)
+ {
+ Map<String, String> result = cache.getProperties(cacheNS, roleType);
+ if (result != null)
+ {
+ return result;
+ }
+ }
- return getRepository().getRelationshipNameProperties(getInvocationContext(), roleType.getName());
+ Map<String, String> result = getRepository().getRelationshipNameProperties(getInvocationContext(), roleType.getName());
+
+ if (cache != null)
+ {
+ cache.putProperties(cacheNS, roleType, result);
+ }
+
+ return result;
}
public Map<String, String> getProperties(String roleTypeName) throws IdentityException
@@ -649,7 +936,23 @@
{
checkNotNullArgument(role, "Role");
- return getRepository().getRelationshipProperties(getInvocationContext(), createIdentityObjectRelationship(role));
+ if (cache != null)
+ {
+ Map<String, String> result = cache.getProperties(cacheNS, role);
+ if (result != null)
+ {
+ return result;
+ }
+ }
+
+ Map<String, String> result = getRepository().getRelationshipProperties(getInvocationContext(), createIdentityObjectRelationship(role));
+
+ if (cache != null)
+ {
+ cache.putProperties(cacheNS, role, result);
+ }
+
+ return result;
}
public void setProperty(Role role, String name, String value) throws IdentityException
@@ -665,6 +968,12 @@
getRepository().setRelationshipProperties(getInvocationContext(), createIdentityObjectRelationship(role), props);
+ if (cache != null)
+ {
+ cache.invalidateRoleProperties(cacheNS, role);
+ cache.putProperties(cacheNS, role, getProperties(role));
+ }
+
postPropertiesSet(role, props);
}
@@ -681,6 +990,13 @@
getRepository().setRelationshipNameProperties(getInvocationContext(), roleType.getName(), props);
+ if (cache != null)
+ {
+ cache.invalidateRoleTypeProperties(cacheNS, roleType);
+ cache.putProperties(cacheNS, roleType, getProperties(roleType));
+ }
+
+
postPropertiesSet(roleType, props);
}
@@ -697,6 +1013,13 @@
setProperty(new SimpleRoleType(roleTypeName), name, value);
+ if (cache != null)
+ {
+ cache.invalidateRoleTypeProperties(cacheNS, new SimpleRoleType(roleTypeName));
+ cache.putProperties(cacheNS, new SimpleRoleType(roleTypeName), getProperties(new SimpleRoleType(roleTypeName)));
+ }
+
+
postPropertiesSet(new SimpleRoleType(roleTypeName), props);
}
@@ -709,6 +1032,13 @@
getRepository().setRelationshipProperties(getInvocationContext(), createIdentityObjectRelationship(role), properties);
+ if (cache != null)
+ {
+ cache.invalidateRoleProperties(cacheNS, role);
+ cache.putProperties(cacheNS, role, getProperties(role));
+ }
+
+
postPropertiesSet(role, properties);
}
@@ -721,6 +1051,12 @@
getRepository().setRelationshipNameProperties(getInvocationContext(), roleType.getName(), properties);
+ if (cache != null)
+ {
+ cache.invalidateRoleTypeProperties(cacheNS, roleType);
+ cache.putProperties(cacheNS, roleType, getProperties(roleType));
+ }
+
postPropertiesSet(roleType, properties);
}
@@ -732,6 +1068,12 @@
setProperties(new SimpleRoleType(roleTypeName), properties);
+ if (cache != null)
+ {
+ cache.invalidateRoleTypeProperties(cacheNS, new SimpleRoleType(roleTypeName));
+ cache.putProperties(cacheNS, new SimpleRoleType(roleTypeName), getProperties(new SimpleRoleType(roleTypeName)));
+ }
+
postPropertiesSet(new SimpleRoleType(roleTypeName), properties);
}
@@ -748,6 +1090,13 @@
getRepository().removeRelationshipProperties(getInvocationContext(), createIdentityObjectRelationship(role), names);
+ if (cache != null)
+ {
+ cache.invalidateRoleProperties(cacheNS, role);
+ cache.putProperties(cacheNS, role, getProperties(role));
+ }
+
+
postPropertiesRemove(role, names);
}
@@ -763,6 +1112,12 @@
getRepository().removeRelationshipNameProperties(getInvocationContext(), roleType.getName(), names);
+ if (cache != null)
+ {
+ cache.invalidateRoleTypeProperties(cacheNS, roleType);
+ cache.putProperties(cacheNS, roleType, getProperties(roleType));
+ }
+
postPropertiesRemove(roleType, names);
}
@@ -777,6 +1132,12 @@
removeProperty(new SimpleRoleType(roleTypeName), name);
+ if (cache != null)
+ {
+ cache.invalidateRoleTypeProperties(cacheNS, new SimpleRoleType(roleTypeName));
+ cache.putProperties(cacheNS, new SimpleRoleType(roleTypeName), getProperties(new SimpleRoleType(roleTypeName)));
+ }
+
postPropertiesRemove(new SimpleRoleType(roleTypeName), names);
}
Added: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/AbstractSearch.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/AbstractSearch.java (rev 0)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/AbstractSearch.java 2009-11-04 22:30:01 UTC (rev 905)
@@ -0,0 +1,49 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2009, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* 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.identity.idm.impl.cache;
+
+import org.jboss.identity.idm.api.IdentitySearchCriteria;
+
+import java.io.Serializable;
+
+public abstract class AbstractSearch implements Serializable
+{
+ private IdentitySearchCriteria searchCriteria;
+
+ public IdentitySearchCriteria getSearchCriteria()
+ {
+ return searchCriteria;
+ }
+
+ public void setSearchCriteria(IdentitySearchCriteria searchCriteria)
+ {
+ this.searchCriteria = searchCriteria;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return searchCriteria != null ? searchCriteria.hashCode() : 0;
+ }
+}
Added: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/GroupSearchImpl.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/GroupSearchImpl.java (rev 0)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/GroupSearchImpl.java 2009-11-04 22:30:01 UTC (rev 905)
@@ -0,0 +1,213 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2009, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* 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.identity.idm.impl.cache;
+
+import org.jboss.identity.idm.cache.GroupSearch;
+
+import java.util.Collection;
+import java.util.HashSet;
+
+public class GroupSearchImpl extends AbstractSearch implements GroupSearch
+{
+ private String groupId;
+
+ private String groupType;
+
+ private Collection<String> associatedUserIds = new HashSet<String>();
+
+ private Collection<String> relatedUserIds = new HashSet<String>();
+
+ private Collection<String> associatedGroupIds = new HashSet<String>();
+
+ private Collection<String> relatedGroupIds = new HashSet<String>();
+
+ private Boolean parent;
+
+ private Boolean cascade;
+
+ public String getGroupId()
+ {
+ return groupId;
+ }
+
+ public void setGroupId(String groupId)
+ {
+ this.groupId = groupId;
+ }
+
+ public String getGroupType()
+ {
+ return groupType;
+ }
+
+ public void setGroupType(String groupType)
+ {
+ this.groupType = groupType;
+ }
+
+ public Collection<String> getAssociatedUserIds()
+ {
+ return associatedUserIds;
+ }
+
+ public void setAssociatedUserIds(Collection<String> associatedUserIds)
+ {
+ this.associatedUserIds = associatedUserIds;
+ }
+
+ public void addAssociatedUserId(String id)
+ {
+ this.associatedUserIds.add(id);
+ }
+
+ public Collection<String> getRelatedUserIds()
+ {
+ return relatedUserIds;
+ }
+
+ public void setRelatedUserIds(Collection<String> relatedUserIds)
+ {
+ this.relatedUserIds = relatedUserIds;
+ }
+
+ public void addRelatedUserId(String id)
+ {
+ this.relatedUserIds.add(id);
+ }
+
+ public Collection<String> getAssociatedGroupIds()
+ {
+ return associatedGroupIds;
+ }
+
+ public void setAssociatedGroupIds(Collection<String> associatedGroupIds)
+ {
+ this.associatedGroupIds = associatedGroupIds;
+ }
+
+ public void addAssociatedGroupId(String id)
+ {
+ this.associatedGroupIds.add(id);
+ }
+
+ public Collection<String> getRelatedGroupIds()
+ {
+ return relatedGroupIds;
+ }
+
+ public void setRelatedGroupIds(Collection<String> relatedGroupIds)
+ {
+ this.relatedGroupIds = relatedGroupIds;
+ }
+
+ public void addRelatedGroupId(String id)
+ {
+ this.relatedGroupIds.add(id);
+ }
+
+ public Boolean isParent()
+ {
+ return parent;
+ }
+
+ public void setParent(Boolean parent)
+ {
+ this.parent = parent;
+ }
+
+ public Boolean isCascade()
+ {
+ return cascade;
+ }
+
+ public void setCascade(Boolean cascade)
+ {
+ this.cascade = cascade;
+ }
+
+ @Override
+ public boolean equals(Object o)
+ {
+ if (this == o)
+ {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass())
+ {
+ return false;
+ }
+
+ GroupSearchImpl that = (GroupSearchImpl)o;
+
+ if (associatedGroupIds != null ? !associatedGroupIds.equals(that.associatedGroupIds) : that.associatedGroupIds != null)
+ {
+ return false;
+ }
+ if (associatedUserIds != null ? !associatedUserIds.equals(that.associatedUserIds) : that.associatedUserIds != null)
+ {
+ return false;
+ }
+ if (cascade != null ? !cascade.equals(that.cascade) : that.cascade != null)
+ {
+ return false;
+ }
+ if (groupId != null ? !groupId.equals(that.groupId) : that.groupId != null)
+ {
+ return false;
+ }
+ if (groupType != null ? !groupType.equals(that.groupType) : that.groupType != null)
+ {
+ return false;
+ }
+ if (parent != null ? !parent.equals(that.parent) : that.parent != null)
+ {
+ return false;
+ }
+ if (relatedGroupIds != null ? !relatedGroupIds.equals(that.relatedGroupIds) : that.relatedGroupIds != null)
+ {
+ return false;
+ }
+ if (relatedUserIds != null ? !relatedUserIds.equals(that.relatedUserIds) : that.relatedUserIds != null)
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ int result = super.hashCode();
+ result = 31 * result + (groupId != null ? groupId.hashCode() : 0);
+ result = 31 * result + (groupType != null ? groupType.hashCode() : 0);
+ result = 31 * result + (associatedUserIds != null ? associatedUserIds.hashCode() : 0);
+ result = 31 * result + (relatedUserIds != null ? relatedUserIds.hashCode() : 0);
+ result = 31 * result + (associatedGroupIds != null ? associatedGroupIds.hashCode() : 0);
+ result = 31 * result + (relatedGroupIds != null ? relatedGroupIds.hashCode() : 0);
+ result = 31 * result + (parent != null ? parent.hashCode() : 0);
+ result = 31 * result + (cascade != null ? cascade.hashCode() : 0);
+ return result;
+ }
+}
Added: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/RelationshipSearchImpl.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/RelationshipSearchImpl.java (rev 0)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/RelationshipSearchImpl.java 2009-11-04 22:30:01 UTC (rev 905)
@@ -0,0 +1,125 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2009, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* 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.identity.idm.impl.cache;
+
+import org.jboss.identity.idm.cache.RelationshipSearch;
+import org.jboss.identity.idm.api.IdentityType;
+import org.jboss.identity.idm.impl.api.model.GroupId;
+import org.jboss.identity.idm.impl.api.model.SimpleGroup;
+import org.jboss.identity.idm.impl.api.model.SimpleUser;
+
+import java.util.Collection;
+import java.util.HashSet;
+
+public class RelationshipSearchImpl extends AbstractSearch implements RelationshipSearch
+{
+ private Collection<IdentityType> parents = new HashSet<IdentityType>();
+
+ private Collection<IdentityType> members = new HashSet<IdentityType>();
+
+ public Collection<IdentityType> getParents()
+ {
+ return parents;
+ }
+
+ public Collection<IdentityType> getMembers()
+ {
+ return members;
+ }
+
+ public void setParents(Collection<IdentityType> parents)
+ {
+ this.parents = parents;
+ }
+
+ public void setMembers(Collection<IdentityType> members)
+ {
+ this.members = members;
+ }
+
+ public void addParent(IdentityType it)
+ {
+ parents.add(it);
+ }
+
+ public void addMember(IdentityType it)
+ {
+ members.add(it);
+ }
+
+ public void addParent(String id)
+ {
+ if (GroupId.validateId(id))
+ {
+ parents.add(new SimpleGroup(new GroupId(id)));
+ return;
+ }
+ parents.add(new SimpleUser(id));
+ }
+
+ public void addMember(String id)
+ {
+ if (GroupId.validateId(id))
+ {
+ members.add(new SimpleGroup(new GroupId(id)));
+ return;
+ }
+ members.add(new SimpleUser(id));
+ }
+
+ @Override
+ public boolean equals(Object o)
+ {
+ if (this == o)
+ {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass())
+ {
+ return false;
+ }
+
+ RelationshipSearchImpl that = (RelationshipSearchImpl)o;
+
+ if (members != null ? !members.equals(that.members) : that.members != null)
+ {
+ return false;
+ }
+ if (parents != null ? !parents.equals(that.parents) : that.parents != null)
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ int result = super.hashCode();
+ result = 31 * result + (parents != null ? parents.hashCode() : 0);
+ result = 31 * result + (members != null ? members.hashCode() : 0);
+ return result;
+ }
+}
Added: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/RoleSearchImpl.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/RoleSearchImpl.java (rev 0)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/RoleSearchImpl.java 2009-11-04 22:30:01 UTC (rev 905)
@@ -0,0 +1,90 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2009, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* 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.identity.idm.impl.cache;
+
+import org.jboss.identity.idm.cache.RoleSearch;
+import org.jboss.identity.idm.api.RoleType;
+
+public class RoleSearchImpl extends AbstractSearch implements RoleSearch
+{
+
+ private String identityTypeId;
+
+ private RoleType roleType;
+
+ public String getIdentityTypeId()
+ {
+ return identityTypeId;
+ }
+
+ public void setIdentityTypeId(String identityTypeId)
+ {
+ this.identityTypeId = identityTypeId;
+ }
+
+ public RoleType getRoleType()
+ {
+ return roleType;
+ }
+
+ public void setRoleType(RoleType roleType)
+ {
+ this.roleType = roleType;
+ }
+
+ @Override
+ public boolean equals(Object o)
+ {
+ if (this == o)
+ {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass())
+ {
+ return false;
+ }
+
+ RoleSearchImpl that = (RoleSearchImpl)o;
+
+ if (identityTypeId != null ? !identityTypeId.equals(that.identityTypeId) : that.identityTypeId != null)
+ {
+ return false;
+ }
+ if (roleType != null ? !roleType.equals(that.roleType) : that.roleType != null)
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ int result = super.hashCode();
+ result = 31 * result + (identityTypeId != null ? identityTypeId.hashCode() : 0);
+ result = 31 * result + (roleType != null ? roleType.hashCode() : 0);
+ return result;
+ }
+}
Added: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/RoleTypeSearchImpl.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/RoleTypeSearchImpl.java (rev 0)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/RoleTypeSearchImpl.java 2009-11-04 22:30:01 UTC (rev 905)
@@ -0,0 +1,90 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2009, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* 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.identity.idm.impl.cache;
+
+import org.jboss.identity.idm.cache.RoleTypeSearch;
+import org.jboss.identity.idm.api.Group;
+import org.jboss.identity.idm.api.User;
+
+public class RoleTypeSearchImpl extends AbstractSearch implements RoleTypeSearch
+{
+ private User user;
+
+ private Group group;
+
+ public User getUser()
+ {
+ return user;
+ }
+
+ public void setUser(User user)
+ {
+ this.user = user;
+ }
+
+ public Group getGroup()
+ {
+ return group;
+ }
+
+ public void setGroup(Group group)
+ {
+ this.group = group;
+ }
+
+ @Override
+ public boolean equals(Object o)
+ {
+ if (this == o)
+ {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass())
+ {
+ return false;
+ }
+
+ RoleTypeSearchImpl that = (RoleTypeSearchImpl)o;
+
+ if (group != null ? !group.equals(that.group) : that.group != null)
+ {
+ return false;
+ }
+ if (user != null ? !user.equals(that.user) : that.user != null)
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ int result = super.hashCode();
+ result = 31 * result + (user != null ? user.hashCode() : 0);
+ result = 31 * result + (group != null ? group.hashCode() : 0);
+ return result;
+ }
+}
Added: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/UserSearchImpl.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/UserSearchImpl.java (rev 0)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/UserSearchImpl.java 2009-11-04 22:30:01 UTC (rev 905)
@@ -0,0 +1,180 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2009, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* 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.identity.idm.impl.cache;
+
+import org.jboss.identity.idm.cache.UserSearch;
+
+import java.util.Collection;
+import java.util.HashSet;
+
+public class UserSearchImpl extends AbstractSearch implements UserSearch
+{
+
+ private String userId;
+
+ private Collection<String> associatedUserIds = new HashSet<String>();
+
+ private Collection<String> relatedUserIds = new HashSet<String>();
+
+ private Collection<String> associatedGroupTypeNames = new HashSet<String>();
+
+ private Collection<String> relatedGroupTypeNames = new HashSet<String>();
+
+ private Boolean cascade;
+
+ public String getUserId()
+ {
+ return userId;
+ }
+
+ public void setUserId(String userId)
+ {
+ this.userId = userId;
+ }
+
+ public Collection<String> getAssociatedUserIds()
+ {
+ return associatedUserIds;
+ }
+
+ public void setAssociatedUserIds(Collection<String> associatedUserIds)
+ {
+ this.associatedUserIds = associatedUserIds;
+ }
+
+ public void addAssociatedUserId(String id)
+ {
+ this.associatedUserIds.add(id);
+ }
+
+ public Collection<String> getRelatedUserIds()
+ {
+ return relatedUserIds;
+ }
+
+ public void setRelatedUserIds(Collection<String> relatedUserIds)
+ {
+ this.relatedUserIds = relatedUserIds;
+ }
+
+ public void addRelatedUserId(String id)
+ {
+ this.relatedUserIds.add(id);
+ }
+
+ public Collection<String> getAssociatedGroupTypeNames()
+ {
+ return associatedGroupTypeNames;
+ }
+
+ public void setAssociatedGroupTypeNames(Collection<String> associatedGroupTypeNames)
+ {
+ this.associatedGroupTypeNames = associatedGroupTypeNames;
+ }
+
+ public void addAssociatedGroupId(String id)
+ {
+ this.associatedGroupTypeNames.add(id);
+ }
+
+ public Collection<String> getRelatedGroupTypeNames()
+ {
+ return relatedGroupTypeNames;
+ }
+
+ public void setRelatedGroupTypeNames(Collection<String> relatedGroupTypeNames)
+ {
+ this.relatedGroupTypeNames = relatedGroupTypeNames;
+ }
+
+ public void addRelatedGroupId(String id)
+ {
+ this.relatedGroupTypeNames.add(id);
+ }
+
+ public Boolean isCascade()
+ {
+ return cascade;
+ }
+
+ public void setCascade(Boolean cascade)
+ {
+ this.cascade = cascade;
+ }
+
+ @Override
+ public boolean equals(Object o)
+ {
+ if (this == o)
+ {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass())
+ {
+ return false;
+ }
+
+ UserSearchImpl that = (UserSearchImpl)o;
+
+ if (associatedGroupTypeNames != null ? !associatedGroupTypeNames.equals(that.associatedGroupTypeNames) : that.associatedGroupTypeNames != null)
+ {
+ return false;
+ }
+ if (associatedUserIds != null ? !associatedUserIds.equals(that.associatedUserIds) : that.associatedUserIds != null)
+ {
+ return false;
+ }
+ if (cascade != null ? !cascade.equals(that.cascade) : that.cascade != null)
+ {
+ return false;
+ }
+ if (relatedGroupTypeNames != null ? !relatedGroupTypeNames.equals(that.relatedGroupTypeNames) : that.relatedGroupTypeNames != null)
+ {
+ return false;
+ }
+ if (relatedUserIds != null ? !relatedUserIds.equals(that.relatedUserIds) : that.relatedUserIds != null)
+ {
+ return false;
+ }
+ if (userId != null ? !userId.equals(that.userId) : that.userId != null)
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ int result = super.hashCode();
+ result = 31 * result + (userId != null ? userId.hashCode() : 0);
+ result = 31 * result + (associatedUserIds != null ? associatedUserIds.hashCode() : 0);
+ result = 31 * result + (relatedUserIds != null ? relatedUserIds.hashCode() : 0);
+ result = 31 * result + (associatedGroupTypeNames != null ? associatedGroupTypeNames.hashCode() : 0);
+ result = 31 * result + (relatedGroupTypeNames != null ? relatedGroupTypeNames.hashCode() : 0);
+ result = 31 * result + (cascade != null ? cascade.hashCode() : 0);
+ return result;
+ }
+}
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/configuration/IdentityConfigurationImpl.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/configuration/IdentityConfigurationImpl.java 2009-11-03 14:33:23 UTC (rev 904)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/configuration/IdentityConfigurationImpl.java 2009-11-04 22:30:01 UTC (rev 905)
@@ -44,6 +44,7 @@
import org.jboss.identity.idm.spi.store.IdentityStore;
import org.jboss.identity.idm.spi.store.AttributeStore;
import org.jboss.identity.idm.spi.repository.IdentityStoreRepository;
+import org.jboss.identity.idm.cache.APICacheProvider;
import java.util.logging.Logger;
import java.util.logging.Level;
@@ -248,9 +249,53 @@
mapper = new IdentityObjectTypeMapperImpl(metaData.getGroupTypeMappings(), metaData.getIdentityMapping());
}
+ // Cache
+
+ Map<String, String> cacheProps = new HashMap<String, String>();
+ String cacheClassName = null;
+
+ // Parse all 'cache.' prefixed options
+ for (String key : metaData.getOptions().keySet())
+ {
+ if (key.startsWith("cache."))
+ {
+ if (metaData.getOptions().get(key).size() > 0)
+ {
+ cacheProps.put(key, metaData.getOptions().get(key).get(0));
+ }
+ if (key.equals("cache.providerClass") && metaData.getOptions().get(key).size() > 0)
+ {
+ cacheClassName = metaData.getOptions().get(key).get(0);
+ }
+ }
+ }
+
+ APICacheProvider provider = null;
+
+ // Instantiate provider
+ if (cacheClassName != null)
+ {
+ Class repoClass = null;
+ try
+ {
+ repoClass = Class.forName(cacheClassName);
+ }
+ catch (ClassNotFoundException e)
+ {
+ throw new IdentityException("Cannot instantiate APICacheProvider:" + cacheClassName, e);
+ }
+
+ Constructor ct = repoClass.getConstructor();
+
+ provider = (APICacheProvider)ct.newInstance();
+
+ provider.initialize(cacheProps);
+ }
+
+
//IdentitySession session = new IdentitySessionImpl(realmName, repo, mapper);
IdentitySessionConfigurationContext sessionConfigCtx =
- new IdentitySessionConfigurationContext(realmName, configMD, repo, mapper);
+ new IdentitySessionConfigurationContext(realmName, configMD, repo, mapper, provider);
sessionCtxMap.put(realmName, sessionConfigCtx);
}
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/configuration/IdentitySessionConfigurationContext.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/configuration/IdentitySessionConfigurationContext.java 2009-11-03 14:33:23 UTC (rev 904)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/configuration/IdentitySessionConfigurationContext.java 2009-11-04 22:30:01 UTC (rev 905)
@@ -27,6 +27,7 @@
import org.jboss.identity.idm.spi.repository.IdentityStoreRepository;
import org.jboss.identity.idm.spi.configuration.metadata.IdentityConfigurationMetaData;
import org.jboss.identity.idm.impl.api.session.mapper.IdentityObjectTypeMapper;
+import org.jboss.identity.idm.cache.APICacheProvider;
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
@@ -41,16 +42,19 @@
private final IdentityConfigurationMetaData identityConfigurationMetaData;
private final IdentityStoreRepository repository;
private final IdentityObjectTypeMapper typeMapper;
+ private final APICacheProvider apiCacheProvider;
public IdentitySessionConfigurationContext(String realmName,
IdentityConfigurationMetaData identityConfigurationMetaData,
IdentityStoreRepository repository,
- IdentityObjectTypeMapper typeMapper)
+ IdentityObjectTypeMapper typeMapper,
+ APICacheProvider apiCacheProvider)
{
this.realmName = realmName;
this.identityConfigurationMetaData = identityConfigurationMetaData;
this.repository = repository;
this.typeMapper = typeMapper;
+ this.apiCacheProvider = apiCacheProvider;
}
public String getRealmName()
@@ -72,4 +76,9 @@
{
return typeMapper;
}
+
+ public APICacheProvider getApiCacheProvider()
+ {
+ return apiCacheProvider;
+ }
}
Added: idm/trunk/idm-testsuite/src/test/resources/jboss-cache.xml
===================================================================
--- idm/trunk/idm-testsuite/src/test/resources/jboss-cache.xml (rev 0)
+++ idm/trunk/idm-testsuite/src/test/resources/jboss-cache.xml 2009-11-04 22:30:01 UTC (rev 905)
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="urn:jboss:jbosscache-core:config:3.0">
+
+</jbosscache>
\ No newline at end of file
Modified: idm/trunk/idm-testsuite/src/test/resources/test-identity-config.xml
===================================================================
--- idm/trunk/idm-testsuite/src/test/resources/test-identity-config.xml 2009-11-03 14:33:23 UTC (rev 904)
+++ idm/trunk/idm-testsuite/src/test/resources/test-identity-config.xml 2009-11-04 22:30:01 UTC (rev 905)
@@ -9,6 +9,16 @@
<identity-type-mappings>
<user-mapping>USER</user-mapping>
</identity-type-mappings>
+ <options>
+ <option>
+ <name>cache.providerClass</name>
+ <value>org.jboss.identity.idm.impl.cache.JBossCacheAPICacheProviderImpl</value>
+ </option>
+ <option>
+ <name>cache.configFile</name>
+ <value>jboss-cache.xml</value>
+ </option>
+ </options>
</realm>
<realm>
<id>realm://portal/SamplePortal/DB</id>
@@ -16,6 +26,16 @@
<identity-type-mappings>
<user-mapping>USER</user-mapping>
</identity-type-mappings>
+ <options>
+ <option>
+ <name>cache.providerClass</name>
+ <value>org.jboss.identity.idm.impl.cache.JBossCacheAPICacheProviderImpl</value>
+ </option>
+ <option>
+ <name>cache.configFile</name>
+ <value>jboss-cache.xml</value>
+ </option>
+ </options>
</realm>
<realm>
<id>realm://RedHat/DB_LDAP</id>
@@ -23,6 +43,16 @@
<identity-type-mappings>
<user-mapping>USER</user-mapping>
</identity-type-mappings>
+ <options>
+ <option>
+ <name>cache.providerClass</name>
+ <value>org.jboss.identity.idm.impl.cache.JBossCacheAPICacheProviderImpl</value>
+ </option>
+ <option>
+ <name>cache.configFile</name>
+ <value>jboss-cache.xml</value>
+ </option>
+ </options>
</realm>
<realm>
<id>realm://portal/SamplePortal/DB_LDAP</id>
@@ -30,6 +60,16 @@
<identity-type-mappings>
<user-mapping>USER</user-mapping>
</identity-type-mappings>
+ <options>
+ <option>
+ <name>cache.providerClass</name>
+ <value>org.jboss.identity.idm.impl.cache.JBossCacheAPICacheProviderImpl</value>
+ </option>
+ <option>
+ <name>cache.configFile</name>
+ <value>jboss-cache.xml</value>
+ </option>
+ </options>
</realm>
</realms>
<repositories>
16 years, 6 months
JBoss Identity SVN: r904 - in idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl: store/hibernate and 1 other directory.
by jboss-identity-commits@lists.jboss.org
Author: bdaw
Date: 2009-11-03 09:33:23 -0500 (Tue, 03 Nov 2009)
New Revision: 904
Modified:
idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObject.java
idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectRelationshipName.java
idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreImpl.java
Log:
- reduce number of getRealm() calls
Modified: idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObject.java
===================================================================
--- idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObject.java 2009-11-03 13:44:56 UTC (rev 903)
+++ idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObject.java 2009-11-03 14:33:23 UTC (rev 904)
@@ -62,21 +62,21 @@
public class HibernateIdentityObject implements IdentityObject
{
public static final String findIdentityObjectByNameAndType =
- "select o from HibernateIdentityObject o where o.realm = :realm and o.name = :name and o.identityType.name = :typeName";
+ "select o from HibernateIdentityObject o where o.realm.name = :realmName and o.name = :name and o.identityType.name = :typeName";
public static final String findIdentityObjectsByType =
- "select o from HibernateIdentityObject o where o.name like :nameFilter and o.realm = :realm and o.identityType.name = :typeName";
+ "select o from HibernateIdentityObject o where o.name like :nameFilter and o.realm.name = :realmName and o.identityType.name = :typeName";
public static final String findIdentityObjectsByTypeOrderedByNameAsc =
- "select o from HibernateIdentityObject o where o.name like :nameFilter and o.realm = :realm and o.identityType.name = :typeName " +
+ "select o from HibernateIdentityObject o where o.name like :nameFilter and o.realm.name = :realmName and o.identityType.name = :typeName " +
"order by o.name asc";
public static final String findIdentityObjectsByTypeOrderedByNameDesc =
- "select o from HibernateIdentityObject o where o.name like :nameFilter and o.realm = :realm and o.identityType.name = :typeName " +
+ "select o from HibernateIdentityObject o where o.name like :nameFilter and o.realm.name = :realmName and o.identityType.name = :typeName " +
"order by o.name desc";
public static final String countIdentityObjectsByType =
- "select count(o.id) from HibernateIdentityObject o where o.realm = :realm and o.identityType.name = :typeName";
+ "select count(o.id) from HibernateIdentityObject o where o.realm.name = :realmName and o.identityType.name = :typeName";
@Id
Modified: idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectRelationshipName.java
===================================================================
--- idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectRelationshipName.java 2009-11-03 13:44:56 UTC (rev 903)
+++ idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectRelationshipName.java 2009-11-03 14:33:23 UTC (rev 904)
@@ -51,17 +51,17 @@
{
public static final String findIdentityObjectRelationshipNameByName =
- "select rn from HibernateIdentityObjectRelationshipName rn where rn.name like :name and rn.realm = :realm";
+ "select rn from HibernateIdentityObjectRelationshipName rn where rn.name like :name and rn.realm.name = :realmName";
public static final String findIdentityObjectRelationshipNames =
- "select rn.name from HibernateIdentityObjectRelationshipName rn where rn.name like :nameFilter and rn.realm = :realm";
+ "select rn.name from HibernateIdentityObjectRelationshipName rn where rn.name like :nameFilter and rn.realm.name = :realmName";
public static final String findIdentityObjectRelationshipNamesOrderedByNameAsc =
- "select rn.name from HibernateIdentityObjectRelationshipName rn where rn.name like :nameFilter and rn.realm = :realm " +
+ "select rn.name from HibernateIdentityObjectRelationshipName rn where rn.name like :nameFilter and rn.realm.name = :realmName " +
"order by rn.name asc";
public static final String findIdentityObjectRelationshipNamesOrderedByNameDesc =
- "select rn.name from HibernateIdentityObjectRelationshipName rn where rn.name like :nameFilter and rn.realm = :realm " +
+ "select rn.name from HibernateIdentityObjectRelationshipName rn where rn.name like :nameFilter and rn.realm.name = :realmName " +
"order by rn.name desc";
public static final String findIdentityObjectRelationshipNamesForIdentityObject =
Modified: idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreImpl.java
===================================================================
--- idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreImpl.java 2009-11-03 13:44:56 UTC (rev 903)
+++ idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreImpl.java 2009-11-03 14:33:23 UTC (rev 904)
@@ -511,7 +511,7 @@
// Check if object with a given name and type is not present already
List<?> results = session.createQuery(HibernateIdentityObject.findIdentityObjectByNameAndType)
- .setParameter("realm", realm)
+ .setParameter("realmName", realm.getName())
.setParameter("name", name)
.setParameter("typeName", identityObjectType.getName())
.list();
@@ -601,7 +601,7 @@
count = ((Number)hibernateSession
.createQuery(HibernateIdentityObject.countIdentityObjectsByType)
.setParameter("typeName", jpaType.getName())
- .setParameter("realm", getRealm(hibernateSession, ctx))
+ .setParameter("realmName", getRealmName(ctx))
.uniqueResult()).intValue();
}
catch (Exception e)
@@ -632,7 +632,7 @@
{
hibernateObject = (HibernateIdentityObject)getHibernateSession(ctx).
createQuery(HibernateIdentityObject.findIdentityObjectByNameAndType)
- .setParameter("realm", getRealm(hibernateSession, ctx))
+ .setParameter("realmName", getRealmName(ctx))
.setParameter("name", name)
.setParameter("typeName", hibernateType.getName())
.uniqueResult();
@@ -712,7 +712,7 @@
}
- q.setParameter("realm", getRealm(hibernateSession, ctx))
+ q.setParameter("realmName", getRealmName(ctx))
.setParameter("typeName", hibernateType.getName());
if (criteria != null && criteria.getFilter() != null)
@@ -1149,8 +1149,8 @@
try
{
- HibernateIdentityObjectRelationshipName hiorn = (HibernateIdentityObjectRelationshipName)hibernateSession.createCriteria(HibernateIdentityObjectRelationshipName.class)
- .add(Restrictions.eq("name", name)).add(Restrictions.eq("realm", realm)).uniqueResult();
+ HibernateIdentityObjectRelationshipName hiorn = (HibernateIdentityObjectRelationshipName)hibernateSession.createQuery(HibernateIdentityObjectRelationshipName.findIdentityObjectRelationshipNameByName)
+ .setParameter("name", name).setParameter("realmName", realm.getName()).uniqueResult();
if (hiorn != null)
{
@@ -1185,8 +1185,8 @@
try
{
- HibernateIdentityObjectRelationshipName hiorn = (HibernateIdentityObjectRelationshipName)hibernateSession.createCriteria(HibernateIdentityObjectRelationshipName.class)
- .add(Restrictions.eq("name", name)).add(Restrictions.eq("realm", getRealm(hibernateSession, ctx))).setCacheable(true).uniqueResult();
+ HibernateIdentityObjectRelationshipName hiorn = (HibernateIdentityObjectRelationshipName)hibernateSession.createQuery(HibernateIdentityObjectRelationshipName.findIdentityObjectRelationshipNameByName)
+ .setParameter("name", name).setParameter("realmName", getRealmName(ctx)).uniqueResult();
if (hiorn == null)
{
@@ -1243,7 +1243,7 @@
q = hibernateSession.createQuery(HibernateIdentityObjectRelationshipName.findIdentityObjectRelationshipNames).setCacheable(true);;
}
- q.setParameter("realm", getRealm(hibernateSession, ctx));
+ q.setParameter("realmName", getRealmName(ctx));
if (criteria != null && criteria.getFilter() != null)
{
@@ -1352,8 +1352,8 @@
try
{
- HibernateIdentityObjectRelationshipName hiorn = (HibernateIdentityObjectRelationshipName)hibernateSession.createCriteria(HibernateIdentityObjectRelationshipName.class)
- .add(Restrictions.eq("name", name)).add(Restrictions.eq("realm", getRealm(hibernateSession, ctx))).setCacheable(true).uniqueResult();
+ HibernateIdentityObjectRelationshipName hiorn = (HibernateIdentityObjectRelationshipName)hibernateSession.createQuery(HibernateIdentityObjectRelationshipName.findIdentityObjectRelationshipNameByName)
+ .setParameter("name", name).setParameter("realmName", getRealmName(ctx)).uniqueResult();
if (hiorn == null)
{
@@ -1381,8 +1381,8 @@
try
{
- HibernateIdentityObjectRelationshipName hiorn = (HibernateIdentityObjectRelationshipName)hibernateSession.createCriteria(HibernateIdentityObjectRelationshipName.class)
- .add(Restrictions.eq("name", name)).add(Restrictions.eq("realm", getRealm(hibernateSession, ctx))).setCacheable(true).uniqueResult();
+ HibernateIdentityObjectRelationshipName hiorn = (HibernateIdentityObjectRelationshipName)hibernateSession.createQuery(HibernateIdentityObjectRelationshipName.findIdentityObjectRelationshipNameByName)
+ .setParameter("name", name).setParameter("realmName", getRealmName(ctx)).uniqueResult();
if (hiorn == null)
{
@@ -1410,8 +1410,8 @@
try
{
- HibernateIdentityObjectRelationshipName hiorn = (HibernateIdentityObjectRelationshipName)hibernateSession.createCriteria(HibernateIdentityObjectRelationshipName.class)
- .add(Restrictions.eq("name", name)).add(Restrictions.eq("realm", getRealm(hibernateSession, ctx))).setCacheable(true).uniqueResult();
+ HibernateIdentityObjectRelationshipName hiorn = (HibernateIdentityObjectRelationshipName)hibernateSession.createQuery(HibernateIdentityObjectRelationshipName.findIdentityObjectRelationshipNameByName)
+ .setParameter("name", name).setParameter("realmName", getRealmName(ctx)).uniqueResult();
if (hiorn == null)
{
@@ -2323,7 +2323,7 @@
hibernateObject = (HibernateIdentityObject)hibernateSession.createQuery(HibernateIdentityObject.findIdentityObjectByNameAndType)
.setParameter("name", io.getName())
.setParameter("typeName", io.getIdentityType().getName())
- .setParameter("realm", getRealm(hibernateSession, ctx))
+ .setParameter("realmName", getRealmName(ctx))
.setCacheable(true)
.uniqueResult();
}
@@ -2460,7 +2460,7 @@
private HibernateRealm getRealm(Session hibernateSession, IdentityStoreInvocationContext ctx) throws IdentityException
{
- if (ctx.getRealmId() == null)
+ if (getRealmName(ctx) == null)
{
throw new IllegalStateException("Realm Id not present");
}
@@ -2482,12 +2482,12 @@
else
{
realm = (HibernateRealm)hibernateSession.
- createCriteria(HibernateRealm.class).add(Restrictions.eq("name", ctx.getRealmId())).setCacheable(true).uniqueResult();
+ createCriteria(HibernateRealm.class).add(Restrictions.eq("name", getRealmName(ctx))).setCacheable(true).uniqueResult();
// TODO: other way to not lazy initialize realm? special method called on every new session creation
if (realm == null)
{
- HibernateRealm newRealm = new HibernateRealm(ctx.getRealmId());
+ HibernateRealm newRealm = new HibernateRealm(getRealmName(ctx));
hibernateSession.persist(newRealm);
return newRealm;
}
@@ -2497,6 +2497,18 @@
return realm;
}
+
+ private String getRealmName(IdentityStoreInvocationContext ctx)
+ {
+ if (isRealmAware())
+ {
+ return ctx.getRealmId();
+ }
+ else
+ {
+ return DEFAULT_REALM_NAME;
+ }
+ }
private boolean isRealmAware()
{
16 years, 6 months
JBoss Identity SVN: r903 - idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/store/hibernate.
by jboss-identity-commits@lists.jboss.org
Author: bdaw
Date: 2009-11-03 08:44:56 -0500 (Tue, 03 Nov 2009)
New Revision: 903
Modified:
idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreImpl.java
Log:
- fix the problem with concurrent realm creation
Modified: idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreImpl.java
===================================================================
--- idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreImpl.java 2009-11-03 12:08:04 UTC (rev 902)
+++ idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreImpl.java 2009-11-03 13:44:56 UTC (rev 903)
@@ -40,6 +40,7 @@
import org.jboss.identity.idm.spi.configuration.metadata.IdentityObjectAttributeMetaData;
import org.jboss.identity.idm.spi.configuration.metadata.IdentityObjectTypeMetaData;
import org.jboss.identity.idm.spi.configuration.metadata.IdentityStoreConfigurationMetaData;
+import org.jboss.identity.idm.spi.configuration.metadata.RealmConfigurationMetaData;
import org.jboss.identity.idm.spi.exception.OperationNotSupportedException;
import org.jboss.identity.idm.spi.model.IdentityObject;
import org.jboss.identity.idm.spi.model.IdentityObjectAttribute;
@@ -338,6 +339,31 @@
addRealm(hibernateSession, DEFAULT_REALM_NAME);
}
+ // If store is realm aware than creat all configured realms
+
+
+
+ if (isRealmAware())
+ {
+ Set<String> realmNames = new HashSet<String>();
+
+ for (RealmConfigurationMetaData realmMD : configurationContext.getConfigurationMetaData().getRealms())
+ {
+ realmNames.add(realmMD.getId());
+ }
+
+ for (String rid : realmNames)
+ {
+ realm = (HibernateRealm)hibernateSession.createCriteria(HibernateRealm.class).
+ add(Restrictions.eq("name",rid)).setCacheable(true).uniqueResult();
+
+ if (realm == null)
+ {
+ addRealm(hibernateSession, rid);
+ }
+ }
+ }
+
if (isManageTransactionDuringBootstrap())
{
hibernateSession.getTransaction().commit();
@@ -2432,7 +2458,7 @@
}
- public HibernateRealm getRealm(Session hibernateSession, IdentityStoreInvocationContext ctx) throws IdentityException
+ private HibernateRealm getRealm(Session hibernateSession, IdentityStoreInvocationContext ctx) throws IdentityException
{
if (ctx.getRealmId() == null)
{
@@ -2455,7 +2481,7 @@
}
else
{
- realm = (HibernateRealm)hibernateSession.
+ realm = (HibernateRealm)hibernateSession.
createCriteria(HibernateRealm.class).add(Restrictions.eq("name", ctx.getRealmId())).setCacheable(true).uniqueResult();
// TODO: other way to not lazy initialize realm? special method called on every new session creation
16 years, 6 months