Author: bdaw
Date: 2006-12-13 10:14:50 -0500 (Wed, 13 Dec 2006)
New Revision: 5830
Added:
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/ConfigurationParser.java
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/IdentityConfigurationMetaDataFactory.java
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/profile/PropertyMappingDatabaseMetaData.java
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/profile/PropertyMappingLDAPMetaData.java
Removed:
trunk/identity/src/main/org/jboss/portal/identity2/config/IdentityConfigurationMetaDataFactory.java
Modified:
trunk/identity/src/main/org/jboss/portal/identity2/config/info/ProfileInfoSupport.java
trunk/identity/src/main/org/jboss/portal/identity2/config/info/PropertyInfoSupport.java
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/profile/ProfileMetaDataFactory.java
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/profile/PropertyMappingMetaData.java
trunk/identity/src/main/org/jboss/portal/identity2/info/PropertyInfo.java
Log:
Identity configuration and user profile metadata
Deleted:
trunk/identity/src/main/org/jboss/portal/identity2/config/IdentityConfigurationMetaDataFactory.java
===================================================================
---
trunk/identity/src/main/org/jboss/portal/identity2/config/IdentityConfigurationMetaDataFactory.java 2006-12-13
15:13:33 UTC (rev 5829)
+++
trunk/identity/src/main/org/jboss/portal/identity2/config/IdentityConfigurationMetaDataFactory.java 2006-12-13
15:14:50 UTC (rev 5830)
@@ -1,276 +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.portal.identity2.config;
-
-import org.jboss.xb.binding.GenericObjectModelFactory;
-import org.jboss.xb.binding.UnmarshallingContext;
-import org.jboss.portal.identity2.config.metadata.IdentityConfigurationMetaData;
-import org.jboss.portal.identity2.config.metadata.ModulesMetaData;
-import org.jboss.portal.identity2.config.metadata.OptionsMetaData;
-import org.jboss.portal.identity2.config.metadata.ModuleMetaData;
-import org.jboss.portal.identity2.config.metadata.ConfigMetaData;
-import org.jboss.portal.identity2.config.metadata.ConfigOptionMetaData;
-import org.jboss.portal.identity2.config.metadata.OptionsGroupMetaData;
-import org.jboss.portal.identity2.config.metadata.OptionsGroupOptionMetaData;
-import org.jboss.portal.identity2.config.metadata.DatasourcesMetaData;
-import org.jboss.portal.identity2.config.metadata.DatasourceMetaData;
-import org.xml.sax.Attributes;
-
-/**
- * @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw
Dawidowicz</a>
- * @version $Revision: 1.1 $
- */
-public class IdentityConfigurationMetaDataFactory implements GenericObjectModelFactory
-{
- private static final org.jboss.logging.Logger log =
org.jboss.logging.Logger.getLogger(IdentityConfigurationMetaDataFactory.class);
-
- public Object newRoot(Object object, UnmarshallingContext unmarshallingContext, String
string, String string1, Attributes attributes)
- {
- return new IdentityConfigurationMetaData();
- }
-
- public Object completeRoot(Object root, UnmarshallingContext unmarshallingContext,
String string, String string1)
- {
- return root;
- }
-
- public Object newChild(Object root, UnmarshallingContext nav, String nsURI, String
localName, Attributes attrs)
- {
- if (root instanceof IdentityConfigurationMetaData)
- {
- if ("modules".equals(localName))
- {
- return new ModulesMetaData();
- }
- else if ("datasources".equals(localName))
- {
- return new DatasourcesMetaData();
- }
- else if("options".equals(localName))
- {
- return new OptionsMetaData();
- }
- }
- if (root instanceof DatasourcesMetaData)
- {
- if ("datasource".equals(localName))
- {
- return new DatasourceMetaData();
- }
- }
- if (root instanceof DatasourceMetaData)
- {
- if ("config".equals(localName))
- {
- return new ConfigMetaData();
- }
- }
- else if (root instanceof ModulesMetaData)
- {
- if ("module".equals(localName))
- {
- return new ModuleMetaData();
- }
- }
- else if (root instanceof ModuleMetaData)
- {
- if ("config".equals(localName))
- {
- return new ConfigMetaData();
- }
- }
- else if (root instanceof ConfigMetaData)
- {
- if ("option".equals(localName))
- {
- return new ConfigOptionMetaData();
- }
- }
- else if (root instanceof OptionsMetaData)
- {
- if ("option-group".equals(localName))
- {
- return new OptionsGroupMetaData();
- }
- }
- else if (root instanceof OptionsGroupMetaData)
- {
- if ("option".equals(localName))
- {
- return new OptionsGroupOptionMetaData();
- }
- }
- return null;
- }
-
- public void addChild(Object parent, Object child, UnmarshallingContext nav, String
nsURI, String localName)
- {
- if (parent instanceof IdentityConfigurationMetaData)
- {
- IdentityConfigurationMetaData identity = (IdentityConfigurationMetaData)parent;
- if (child instanceof ModulesMetaData)
- {
- identity.setModules((ModulesMetaData)child);
- }
- else if (child instanceof DatasourcesMetaData)
- {
- identity.setDatasources((DatasourcesMetaData)child);
- }
- else if (child instanceof OptionsMetaData)
- {
- identity.setOptions((OptionsMetaData)child);
- }
- }
- else if (parent instanceof DatasourcesMetaData)
- {
- DatasourcesMetaData datasources = (DatasourcesMetaData)parent;
- if (child instanceof DatasourceMetaData)
- {
- datasources.addDatasource((DatasourceMetaData)child);
- }
- }
- else if (parent instanceof DatasourceMetaData)
- {
- DatasourceMetaData datasource = (DatasourceMetaData)parent;
- if (child instanceof ConfigMetaData)
- {
- datasource.setConfig((ConfigMetaData)child);
- }
- }
-
- else if (parent instanceof ModulesMetaData)
- {
- ModulesMetaData modules = (ModulesMetaData)parent;
- if (child instanceof ModuleMetaData)
- {
- modules.addModule((ModuleMetaData)child);
- }
- }
- else if (parent instanceof ModuleMetaData)
- {
- ModuleMetaData module = (ModuleMetaData)parent;
- if (child instanceof ConfigMetaData)
- {
- module.setConfig((ConfigMetaData)child);
- }
- }
- else if (parent instanceof ConfigMetaData)
- {
- ConfigMetaData config = (ConfigMetaData)parent;
- if (child instanceof ConfigOptionMetaData)
- {
- config.addOption((ConfigOptionMetaData)child);
- }
- }
- else if (parent instanceof OptionsMetaData)
- {
- OptionsMetaData options = (OptionsMetaData)parent;
- if (child instanceof OptionsGroupMetaData)
- {
- options.addGroup((OptionsGroupMetaData)child);
- }
- }
- else if (parent instanceof OptionsGroupMetaData)
- {
- OptionsGroupMetaData group = (OptionsGroupMetaData)parent;
- if (child instanceof OptionsGroupOptionMetaData)
- {
- group.addOption((OptionsGroupOptionMetaData)child);
- }
- }
- }
-
- public void setValue(Object object, UnmarshallingContext unmarshallingContext, String
nsUri, String localName, String value)
- {
- if (object instanceof ModuleMetaData)
- {
- ModuleMetaData module = (ModuleMetaData)object;
- if ("type".equals(localName))
- {
- module.setType(value);
- }
- else if ("implementation".equals(localName))
- {
- module.setImplementation(value);
- }
- else if ("service-name".equals(localName))
- {
- module.setServiceName(value);
- }
- else if ("class".equals(localName))
- {
- module.setClassName(value);
- }
- }
- if (object instanceof DatasourceMetaData)
- {
- DatasourceMetaData ds = (DatasourceMetaData)object;
- if ("name".equals(localName))
- {
- log.info("@@@@ adding name: " + value);
- ds.setName(value);
- }
- else if ("service-name".equals(localName))
- {
- log.info("@@@@ adding service name: " + value);
- ds.setServiceName(value);
- }
- else if ("class".equals(localName))
- {
- log.info("@@@@ class name: " + value);
- ds.setClassName(value);
- }
- }
- else if (object instanceof ConfigOptionMetaData)
- {
- ConfigOptionMetaData option = (ConfigOptionMetaData)object;
- if ("name".equals(localName))
- {
- option.setName(value);
- }
- else if ("value".equals(localName))
- {
- option.setValue(value);
- }
- }
- else if (object instanceof OptionsGroupMetaData)
- {
- OptionsGroupMetaData group = (OptionsGroupMetaData)object;
- if ("group-name".equals(localName))
- {
- group.setName(value);
- }
- }
- else if (object instanceof OptionsGroupOptionMetaData)
- {
- OptionsGroupOptionMetaData option = (OptionsGroupOptionMetaData)object;
- if ("name".equals(localName))
- {
- option.setName(value);
- }
- else if ("value".equals(localName))
- {
- option.addValue(value);
- }
- }
- }
-}
Modified:
trunk/identity/src/main/org/jboss/portal/identity2/config/info/ProfileInfoSupport.java
===================================================================
---
trunk/identity/src/main/org/jboss/portal/identity2/config/info/ProfileInfoSupport.java 2006-12-13
15:13:33 UTC (rev 5829)
+++
trunk/identity/src/main/org/jboss/portal/identity2/config/info/ProfileInfoSupport.java 2006-12-13
15:14:50 UTC (rev 5830)
@@ -25,6 +25,7 @@
import org.jboss.portal.identity2.info.PropertyInfo;
import org.jboss.portal.identity2.config.metadata.profile.ProfileMetaData;
import org.jboss.portal.identity2.config.metadata.profile.PropertyMetaData;
+import org.jboss.portal.identity.IdentityException;
import java.util.Map;
import java.util.HashMap;
@@ -40,17 +41,25 @@
private Map properties;
- public ProfileInfoSupport(ProfileMetaData profile)
+ public ProfileInfoSupport(ProfileMetaData profile) throws IdentityException
{
- properties = new HashMap();
- Map meta = profile.getProperties();
- for (Iterator iterator = meta.keySet().iterator(); iterator.hasNext();)
+
+ try
{
- String name = (String)iterator.next();
- PropertyMetaData property = (PropertyMetaData)meta.get(name);
- PropertyInfo pi = new PropertyInfoSupport(property);
- properties.put(pi.getName(), pi);
+ properties = new HashMap();
+ Map meta = profile.getProperties();
+ for (Iterator iterator = meta.keySet().iterator(); iterator.hasNext();)
+ {
+ String name = (String)iterator.next();
+ PropertyMetaData property = (PropertyMetaData)meta.get(name);
+ PropertyInfo pi = new PropertyInfoSupport(property);
+ properties.put(pi.getName(), pi);
+ }
}
+ catch (IdentityException e)
+ {
+ throw new IdentityException("PrifileInfo creation error: ", e);
+ }
}
public Map getPropertiesInfo()
Modified:
trunk/identity/src/main/org/jboss/portal/identity2/config/info/PropertyInfoSupport.java
===================================================================
---
trunk/identity/src/main/org/jboss/portal/identity2/config/info/PropertyInfoSupport.java 2006-12-13
15:13:33 UTC (rev 5829)
+++
trunk/identity/src/main/org/jboss/portal/identity2/config/info/PropertyInfoSupport.java 2006-12-13
15:14:50 UTC (rev 5830)
@@ -25,6 +25,8 @@
import org.jboss.portal.identity2.config.metadata.profile.PropertyMetaData;
import org.jboss.portal.identity2.config.metadata.profile.LocalizedValueMetaData;
import org.jboss.portal.common.util.LocalizedString;
+import org.jboss.portal.identity.IdentityException;
+import org.jboss.logging.Logger;
import java.util.Locale;
import java.util.Iterator;
@@ -37,25 +39,37 @@
*/
public class PropertyInfoSupport implements PropertyInfo
{
+ private static final Logger log = Logger.getLogger(PropertyInfo.class);
+
+ //TODO: introduce safe types enums where possible.
+
private String name;
private String type;
private String accessMode;
private String usage;
private LocalizedString displayName;
private LocalizedString description;
- private String mappingType;
- private String mappingValue;
+ private String mappingDBType;
+ private String mappingDBValue;
+ private String mappingLDAPValue;
+ private boolean mappedLDAP;
+ private boolean mappedDB;
- public PropertyInfoSupport(PropertyMetaData meta)
+ public PropertyInfoSupport(PropertyMetaData meta) throws IdentityException
{
+
+
+
name = meta.getName();
type = meta.getType();
accessMode = meta.getAccessMode();
usage = meta.getUsage();
- mappingType = meta.getMapping().getType();
- mappingValue = meta.getMapping().getValue();
+ //mappingType = meta.getMapping().getType();
+ //mappingValue = meta.getMapping().getValue();
+
+
Map descValues = new HashMap();
for (Iterator iterator = meta.getDescription().getValues().iterator();
iterator.hasNext();)
{
@@ -72,6 +86,33 @@
description = new LocalizedString(descValues, Locale.ENGLISH);
displayName = new LocalizedString(dispValues, Locale.ENGLISH);
+ if (meta.getMapping() == null)
+ {
+ throw new IdentityException("Mapping section is missing");
+ }
+ if (meta.getMapping().getMappingDatabase() != null)
+ {
+ if (meta.getMapping().getMappingDatabase().getType() != null &&
meta.getMapping().getMappingDatabase().getValue() != null)
+ {
+ mappedDB = true;
+ mappingDBType = meta.getMapping().getMappingDatabase().getType();
+ mappingDBValue = meta.getMapping().getMappingDatabase().getValue();
+ }
+ }
+
+ if (meta.getMapping().getMappingLDAP() != null)
+ {
+ if (meta.getMapping().getMappingLDAP().getValue() != null)
+ {
+ mappedLDAP = true;
+ mappingLDAPValue = meta.getMapping().getMappingLDAP().getValue();
+ }
+ }
+
+ if (log.isDebugEnabled())
+ {
+ log.debug("created PropertyInfo: " + toString());
+ }
}
public String getName()
@@ -104,13 +145,46 @@
return description;
}
- public String getMappingType()
+ public String getMappingDBType()
{
- return mappingType;
+ return mappingDBType;
}
- public String getMappingValue()
+ public String getMappingLDAPValue()
{
- return mappingValue;
+ return mappingLDAPValue;
}
+
+ public String getMappingDBValue()
+ {
+ return mappingDBValue;
+ }
+
+
+ public boolean isMappedDB()
+ {
+ return mappedDB;
+ }
+
+ public boolean isMappedLDAP()
+ {
+ return mappedLDAP;
+ }
+
+ public String toString()
+ {
+ StringBuffer buf = new StringBuffer();
+ buf.append("name: ").append(name)
+ .append("; type:").append(type)
+ .append("; accessMode:").append(accessMode)
+ .append("; usage: ").append(usage)
+ .append("; displayName: ").append(displayName)
+ .append("; description: ").append(description)
+ .append("; mappingDBType: ").append(mappingDBType)
+ .append("; mappingLDAPValue: ").append(mappingLDAPValue)
+ .append("; mappingDBValue: ").append(mappingDBValue)
+ .append("; mappedDB: ").append(mappedDB)
+ .append("; mappedLDAP: ").append(mappedLDAP);
+ return buf.toString();
+ }
}
Added:
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/ConfigurationParser.java
===================================================================
---
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/ConfigurationParser.java 2006-12-13
15:13:33 UTC (rev 5829)
+++
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/ConfigurationParser.java 2006-12-13
15:14:50 UTC (rev 5830)
@@ -0,0 +1,112 @@
+/*
+* 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.portal.identity2.config.metadata;
+
+import org.jboss.portal.identity2.config.metadata.profile.ProfileMetaData;
+import org.jboss.portal.identity2.config.metadata.profile.ProfileMetaDataFactory;
+import org.jboss.portal.identity.IdentityException;
+import org.jboss.xb.binding.Unmarshaller;
+import org.jboss.xb.binding.UnmarshallerFactory;
+import org.jboss.xb.binding.ObjectModelFactory;
+
+import java.net.URL;
+import java.io.InputStream;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw
Dawidowicz</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class ConfigurationParser
+{
+
+ private static final org.jboss.logging.Logger log =
org.jboss.logging.Logger.getLogger(ConfigurationParser.class);
+
+
+ //TODO: merge this two methods (redundancy)
+
+ /**
+ * Parse identity config file
+ * @param configFile
+ * @return
+ * @throws org.jboss.portal.identity.IdentityException
+ */
+ public static ProfileMetaData parseProfileConfiguration(String configFile) throws
IdentityException
+ {
+ ClassLoader tcl = Thread.currentThread().getContextClassLoader();
+ ProfileMetaData meta;
+ try
+ {
+ log.info("Processing identity profile configuration");
+ if (log.isDebugEnabled())
+ {
+ log.debug("config file: " + configFile);
+ }
+ URL config = tcl.getResource(configFile);
+ InputStream in = config.openStream();
+ // create unmarshaller
+ Unmarshaller unmarshaller =
UnmarshallerFactory.newInstance().newUnmarshaller();
+
+ // create an instance of ObjectModelFactory
+ ObjectModelFactory factory = new ProfileMetaDataFactory();
+
+ // let the object model factory to create an instance of Map and populate it
with data from XML
+ meta = (ProfileMetaData)unmarshaller.unmarshal(in, factory, null);
+
+ // close the XML stream
+ in.close();
+ }
+ catch (Exception e)
+ {
+ throw new IdentityException("Cannot parse identity profile configuration
file", e);
+ }
+ return meta;
+ }
+
+ public static IdentityConfigurationMetaData parseIdentityConfiguration(String
configFile) throws IdentityException
+ {
+ ClassLoader tcl = Thread.currentThread().getContextClassLoader();
+ IdentityConfigurationMetaData meta;
+ try
+ {
+ log.info("Processing portal identity configuration");
+ log.debug("config file: " + configFile);
+ URL config = tcl.getResource(configFile);
+ InputStream in = config.openStream();
+ // create unmarshaller
+ Unmarshaller unmarshaller =
UnmarshallerFactory.newInstance().newUnmarshaller();
+
+ // create an instance of ObjectModelFactory
+ ObjectModelFactory factory = new IdentityConfigurationMetaDataFactory();
+
+ // let the object model factory to create an instance of Map and populate it
with data from XML
+ meta = (IdentityConfigurationMetaData)unmarshaller.unmarshal(in, factory,
null);
+
+ // close the XML stream
+ in.close();
+ }
+ catch (Exception e)
+ {
+ throw new IdentityException("Cannot parse identity configuration
file", e);
+ }
+ return meta;
+ }
+}
Copied:
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/IdentityConfigurationMetaDataFactory.java
(from rev 5770,
trunk/identity/src/main/org/jboss/portal/identity2/config/IdentityConfigurationMetaDataFactory.java)
===================================================================
---
trunk/identity/src/main/org/jboss/portal/identity2/config/IdentityConfigurationMetaDataFactory.java 2006-12-06
09:43:49 UTC (rev 5770)
+++
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/IdentityConfigurationMetaDataFactory.java 2006-12-13
15:14:50 UTC (rev 5830)
@@ -0,0 +1,273 @@
+/*
+* 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.portal.identity2.config.metadata;
+
+import org.jboss.xb.binding.GenericObjectModelFactory;
+import org.jboss.xb.binding.UnmarshallingContext;
+import org.jboss.portal.identity2.config.metadata.IdentityConfigurationMetaData;
+import org.jboss.portal.identity2.config.metadata.ModulesMetaData;
+import org.jboss.portal.identity2.config.metadata.OptionsMetaData;
+import org.jboss.portal.identity2.config.metadata.ModuleMetaData;
+import org.jboss.portal.identity2.config.metadata.ConfigMetaData;
+import org.jboss.portal.identity2.config.metadata.ConfigOptionMetaData;
+import org.jboss.portal.identity2.config.metadata.OptionsGroupMetaData;
+import org.jboss.portal.identity2.config.metadata.OptionsGroupOptionMetaData;
+import org.jboss.portal.identity2.config.metadata.DatasourcesMetaData;
+import org.jboss.portal.identity2.config.metadata.DatasourceMetaData;
+import org.xml.sax.Attributes;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw
Dawidowicz</a>
+ * @version $Revision: 1.1 $
+ */
+public class IdentityConfigurationMetaDataFactory implements GenericObjectModelFactory
+{
+ private static final org.jboss.logging.Logger log =
org.jboss.logging.Logger.getLogger(IdentityConfigurationMetaDataFactory.class);
+
+ public Object newRoot(Object object, UnmarshallingContext unmarshallingContext, String
string, String string1, Attributes attributes)
+ {
+ return new IdentityConfigurationMetaData();
+ }
+
+ public Object completeRoot(Object root, UnmarshallingContext unmarshallingContext,
String string, String string1)
+ {
+ return root;
+ }
+
+ public Object newChild(Object root, UnmarshallingContext nav, String nsURI, String
localName, Attributes attrs)
+ {
+ if (root instanceof IdentityConfigurationMetaData)
+ {
+ if ("modules".equals(localName))
+ {
+ return new ModulesMetaData();
+ }
+ else if ("datasources".equals(localName))
+ {
+ return new DatasourcesMetaData();
+ }
+ else if("options".equals(localName))
+ {
+ return new OptionsMetaData();
+ }
+ }
+ if (root instanceof DatasourcesMetaData)
+ {
+ if ("datasource".equals(localName))
+ {
+ return new DatasourceMetaData();
+ }
+ }
+ if (root instanceof DatasourceMetaData)
+ {
+ if ("config".equals(localName))
+ {
+ return new ConfigMetaData();
+ }
+ }
+ else if (root instanceof ModulesMetaData)
+ {
+ if ("module".equals(localName))
+ {
+ return new ModuleMetaData();
+ }
+ }
+ else if (root instanceof ModuleMetaData)
+ {
+ if ("config".equals(localName))
+ {
+ return new ConfigMetaData();
+ }
+ }
+ else if (root instanceof ConfigMetaData)
+ {
+ if ("option".equals(localName))
+ {
+ return new ConfigOptionMetaData();
+ }
+ }
+ else if (root instanceof OptionsMetaData)
+ {
+ if ("option-group".equals(localName))
+ {
+ return new OptionsGroupMetaData();
+ }
+ }
+ else if (root instanceof OptionsGroupMetaData)
+ {
+ if ("option".equals(localName))
+ {
+ return new OptionsGroupOptionMetaData();
+ }
+ }
+ return null;
+ }
+
+ public void addChild(Object parent, Object child, UnmarshallingContext nav, String
nsURI, String localName)
+ {
+ if (parent instanceof IdentityConfigurationMetaData)
+ {
+ IdentityConfigurationMetaData identity = (IdentityConfigurationMetaData)parent;
+ if (child instanceof ModulesMetaData)
+ {
+ identity.setModules((ModulesMetaData)child);
+ }
+ else if (child instanceof DatasourcesMetaData)
+ {
+ identity.setDatasources((DatasourcesMetaData)child);
+ }
+ else if (child instanceof OptionsMetaData)
+ {
+ identity.setOptions((OptionsMetaData)child);
+ }
+ }
+ else if (parent instanceof DatasourcesMetaData)
+ {
+ DatasourcesMetaData datasources = (DatasourcesMetaData)parent;
+ if (child instanceof DatasourceMetaData)
+ {
+ datasources.addDatasource((DatasourceMetaData)child);
+ }
+ }
+ else if (parent instanceof DatasourceMetaData)
+ {
+ DatasourceMetaData datasource = (DatasourceMetaData)parent;
+ if (child instanceof ConfigMetaData)
+ {
+ datasource.setConfig((ConfigMetaData)child);
+ }
+ }
+
+ else if (parent instanceof ModulesMetaData)
+ {
+ ModulesMetaData modules = (ModulesMetaData)parent;
+ if (child instanceof ModuleMetaData)
+ {
+ modules.addModule((ModuleMetaData)child);
+ }
+ }
+ else if (parent instanceof ModuleMetaData)
+ {
+ ModuleMetaData module = (ModuleMetaData)parent;
+ if (child instanceof ConfigMetaData)
+ {
+ module.setConfig((ConfigMetaData)child);
+ }
+ }
+ else if (parent instanceof ConfigMetaData)
+ {
+ ConfigMetaData config = (ConfigMetaData)parent;
+ if (child instanceof ConfigOptionMetaData)
+ {
+ config.addOption((ConfigOptionMetaData)child);
+ }
+ }
+ else if (parent instanceof OptionsMetaData)
+ {
+ OptionsMetaData options = (OptionsMetaData)parent;
+ if (child instanceof OptionsGroupMetaData)
+ {
+ options.addGroup((OptionsGroupMetaData)child);
+ }
+ }
+ else if (parent instanceof OptionsGroupMetaData)
+ {
+ OptionsGroupMetaData group = (OptionsGroupMetaData)parent;
+ if (child instanceof OptionsGroupOptionMetaData)
+ {
+ group.addOption((OptionsGroupOptionMetaData)child);
+ }
+ }
+ }
+
+ public void setValue(Object object, UnmarshallingContext unmarshallingContext, String
nsUri, String localName, String value)
+ {
+ if (object instanceof ModuleMetaData)
+ {
+ ModuleMetaData module = (ModuleMetaData)object;
+ if ("type".equals(localName))
+ {
+ module.setType(value);
+ }
+ else if ("implementation".equals(localName))
+ {
+ module.setImplementation(value);
+ }
+ else if ("service-name".equals(localName))
+ {
+ module.setServiceName(value);
+ }
+ else if ("class".equals(localName))
+ {
+ module.setClassName(value);
+ }
+ }
+ if (object instanceof DatasourceMetaData)
+ {
+ DatasourceMetaData ds = (DatasourceMetaData)object;
+ if ("name".equals(localName))
+ {
+ ds.setName(value);
+ }
+ else if ("service-name".equals(localName))
+ {
+ ds.setServiceName(value);
+ }
+ else if ("class".equals(localName))
+ {
+ ds.setClassName(value);
+ }
+ }
+ else if (object instanceof ConfigOptionMetaData)
+ {
+ ConfigOptionMetaData option = (ConfigOptionMetaData)object;
+ if ("name".equals(localName))
+ {
+ option.setName(value);
+ }
+ else if ("value".equals(localName))
+ {
+ option.setValue(value);
+ }
+ }
+ else if (object instanceof OptionsGroupMetaData)
+ {
+ OptionsGroupMetaData group = (OptionsGroupMetaData)object;
+ if ("group-name".equals(localName))
+ {
+ group.setName(value);
+ }
+ }
+ else if (object instanceof OptionsGroupOptionMetaData)
+ {
+ OptionsGroupOptionMetaData option = (OptionsGroupOptionMetaData)object;
+ if ("name".equals(localName))
+ {
+ option.setName(value);
+ }
+ else if ("value".equals(localName))
+ {
+ option.addValue(value);
+ }
+ }
+ }
+}
Modified:
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/profile/ProfileMetaDataFactory.java
===================================================================
---
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/profile/ProfileMetaDataFactory.java 2006-12-13
15:13:33 UTC (rev 5829)
+++
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/profile/ProfileMetaDataFactory.java 2006-12-13
15:14:50 UTC (rev 5830)
@@ -23,8 +23,6 @@
import org.jboss.xb.binding.GenericObjectModelFactory;
import org.jboss.xb.binding.UnmarshallingContext;
-import org.jboss.portal.identity2.config.IdentityConfigurationMetaDataFactory;
-import org.jboss.portal.identity2.config.metadata.IdentityConfigurationMetaData;
import org.jboss.portal.common.util.LocaleInfo;
import org.xml.sax.Attributes;
@@ -86,6 +84,17 @@
return value;
}
}
+ else if (root instanceof PropertyMappingMetaData)
+ {
+ if ("database".equals(localName))
+ {
+ return new PropertyMappingDatabaseMetaData();
+ }
+ else if ("ldap".equals(localName))
+ {
+ return new PropertyMappingLDAPMetaData();
+ }
+ }
return null;
}
@@ -110,7 +119,7 @@
}
else if ("dispalay-name".equals(localName))
{
- describable.getDisplayName().getValues().add(child);
+ describable.getDisplayName().getValues().add(child);
}
}
else if (child instanceof PropertyMappingMetaData)
@@ -118,6 +127,18 @@
describable.setMapping((PropertyMappingMetaData)child);
}
}
+ else if (parent instanceof PropertyMappingMetaData)
+ {
+ PropertyMappingMetaData mapping = (PropertyMappingMetaData)parent;
+ if (child instanceof PropertyMappingDatabaseMetaData)
+ {
+ mapping.setMappingDatabase((PropertyMappingDatabaseMetaData)child);
+ }
+ else if (child instanceof PropertyMappingLDAPMetaData)
+ {
+ mapping.setMappingLDAP((PropertyMappingLDAPMetaData)child);
+ }
+ }
}
public void setValue(Object object, UnmarshallingContext unmarshallingContext, String
nsUri, String localName, String value)
@@ -135,16 +156,28 @@
}
else if ("access-mode".equals(localName))
{
- property.setType(value);
+ property.setAccessMode(value);
}
else if ("usage".equals(localName))
{
property.setUsage(value);
}
}
- else if (object instanceof PropertyMappingMetaData)
+ else if (object instanceof LocalizedValueMetaData)
{
- PropertyMappingMetaData mapping = (PropertyMappingMetaData)object;
+ LocalizedValueMetaData localized = (LocalizedValueMetaData)object;
+ if ("description".equals(localName))
+ {
+ localized.setValue(value);
+ }
+ else if ("display-name".equals(localName))
+ {
+ localized.setValue(value);
+ }
+ }
+ else if (object instanceof PropertyMappingDatabaseMetaData)
+ {
+ PropertyMappingDatabaseMetaData mapping =
(PropertyMappingDatabaseMetaData)object;
if ("type".equals(localName))
{
mapping.setType(value);
@@ -154,5 +187,13 @@
mapping.setValue(value);
}
}
+ else if (object instanceof PropertyMappingLDAPMetaData)
+ {
+ PropertyMappingLDAPMetaData mapping = (PropertyMappingLDAPMetaData)object;
+ if ("value".equals(localName))
+ {
+ mapping.setValue(value);
+ }
+ }
}
}
Added:
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/profile/PropertyMappingDatabaseMetaData.java
===================================================================
---
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/profile/PropertyMappingDatabaseMetaData.java 2006-12-13
15:13:33 UTC (rev 5829)
+++
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/profile/PropertyMappingDatabaseMetaData.java 2006-12-13
15:14:50 UTC (rev 5830)
@@ -0,0 +1,57 @@
+/*
+* 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.portal.identity2.config.metadata.profile;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw
Dawidowicz</a>
+ * @version $Revision: 1.1 $
+ */
+public class PropertyMappingDatabaseMetaData
+{
+ private String type;
+ private String value;
+
+ public PropertyMappingDatabaseMetaData()
+ {
+
+ }
+
+ public String getType()
+ {
+ return type;
+ }
+
+ public void setType(String type)
+ {
+ this.type = type;
+ }
+
+ public String getValue()
+ {
+ return value;
+ }
+
+ public void setValue(String value)
+ {
+ this.value = value;
+ }
+}
Added:
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/profile/PropertyMappingLDAPMetaData.java
===================================================================
---
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/profile/PropertyMappingLDAPMetaData.java 2006-12-13
15:13:33 UTC (rev 5829)
+++
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/profile/PropertyMappingLDAPMetaData.java 2006-12-13
15:14:50 UTC (rev 5830)
@@ -0,0 +1,46 @@
+/*
+* 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.portal.identity2.config.metadata.profile;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw
Dawidowicz</a>
+ * @version $Revision: 1.1 $
+ */
+public class PropertyMappingLDAPMetaData
+{
+ String value;
+
+ public PropertyMappingLDAPMetaData()
+ {
+
+ }
+
+ public String getValue()
+ {
+ return value;
+ }
+
+ public void setValue(String value)
+ {
+ this.value = value;
+ }
+}
Modified:
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/profile/PropertyMappingMetaData.java
===================================================================
---
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/profile/PropertyMappingMetaData.java 2006-12-13
15:13:33 UTC (rev 5829)
+++
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/profile/PropertyMappingMetaData.java 2006-12-13
15:14:50 UTC (rev 5830)
@@ -27,32 +27,31 @@
*/
public class PropertyMappingMetaData
{
- private String type;
- private String value;
+ private PropertyMappingDatabaseMetaData mappingDatabase;
+ private PropertyMappingLDAPMetaData mappingLDAP;
public PropertyMappingMetaData()
{
}
-
- public String getType()
+ public PropertyMappingDatabaseMetaData getMappingDatabase()
{
- return type;
+ return mappingDatabase;
}
- public void setType(String type)
+ public void setMappingDatabase(PropertyMappingDatabaseMetaData mappingDatabase)
{
- this.type = type;
+ this.mappingDatabase = mappingDatabase;
}
- public String getValue()
+ public PropertyMappingLDAPMetaData getMappingLDAP()
{
- return value;
+ return mappingLDAP;
}
- public void setValue(String value)
+ public void setMappingLDAP(PropertyMappingLDAPMetaData mappingLDAP)
{
- this.value = value;
+ this.mappingLDAP = mappingLDAP;
}
}
Modified: trunk/identity/src/main/org/jboss/portal/identity2/info/PropertyInfo.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity2/info/PropertyInfo.java 2006-12-13
15:13:33 UTC (rev 5829)
+++ trunk/identity/src/main/org/jboss/portal/identity2/info/PropertyInfo.java 2006-12-13
15:14:50 UTC (rev 5830)
@@ -36,19 +36,9 @@
public static final String ACCESS_MODE_READ_WRITE = "read-write";
public static final String USAGE_MANDATORY = "mandatory";
public static final String USAGE_OPTIONAL = "optional";
- public static final String MAPPING_TYPE_COLUMN = "column";
- public static final String MAPPING_TYPE_DYNAMIC = "dynamic";
- public static final String MAPPING_TYPE_ATTRIBUTE = "attribute";
+ public static final String MAPPING_DB_TYPE_COLUMN = "column";
+ public static final String MAPPING_DB_TYPE_DYNAMIC = "dynamic";
-
- /*private String name;
- private String type;
- private String accessMode;
- private String usage;
- private LocalizedString displayName;
- private LocalizedString description;
- private PropertyMappingMetaData mapping;*/
-
public String getName();
public String getType();
@@ -61,10 +51,15 @@
public LocalizedString getDescription();
- public String getMappingType();
+ public String getMappingDBType();
- public String getMappingValue();
+ public String getMappingLDAPValue();
+ public String getMappingDBValue();
+ public boolean isMappedDB();
+ public boolean isMappedLDAP();
+
+
}