ammulder 2003/10/01 14:55:15
Modified: modules/core/src/java/org/apache/geronimo/console/cli
Deployer.java
modules/core/src/java/org/apache/geronimo/deployment/model/j2ee
Displayable.java
modules/core/src/java/org/apache/geronimo/enterprise/deploy/provider
EjbJarDeploymentConfiguration.java
modules/core/src/java/org/apache/geronimo/enterprise/deploy/provider/jar
EjbConverter.java
Log:
Catch up the JSR-88 client to the current DD state
- Now writes all the J2EE info to the Geronimo EJB DD
- Now can save Geronimo DD to disk
Revision Changes Path
1.4 +4 -4
incubator-geronimo/modules/core/src/java/org/apache/geronimo/console/cli/Deployer.java
Index: Deployer.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/console/cli/Deployer.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Deployer.java 1 Oct 2003 04:46:41 -0000 1.3
+++ Deployer.java 1 Oct 2003 21:55:15 -0000 1.4
@@ -305,14 +305,14 @@
out.println(" -- Edit the standard EJB deployment descriptor
(ejb-jar.xml)");
out.println(" 2) Edit the corresponding server-specific
deployment information");
out.println(" 3) Load a saved set of server-specific deployment
information");
- out.println(" -- Save the current set of server-specific
deployment information");
+ out.println(" 4) Save the current set of server-specific
deployment information");
out.println(" -- Edit web services deployment information");
out.println(" -- Deploy or redeploy the JAR into the
application server");
out.println(" 7) Select a new EJB JAR to work with"); //todo:
adjust text when other modules are accepted
out.println(" 8) Manage existing deployments in the server");
String choice;
while(true) {
- out.print("Action ([2-3,7,8] or [Q]uit): ");
+ out.print("Action ([2-4,7,8] or [Q]uit): ");
out.flush();
try {
choice = in.readLine().trim().toLowerCase();
@@ -420,7 +420,7 @@
out.print("File already exists. Overwrite (Y/N)? ");
out.flush();
choice = in.readLine().trim().toLowerCase();
- if(choice.equals("n")) { // todo: makre sure they
entered y or n
+ if(choice.equals("n")) { // todo: make sure they entered
y or n
continue;
}
}
1.3 +3 -3
incubator-geronimo/modules/core/src/java/org/apache/geronimo/deployment/model/j2ee/Displayable.java
Index: Displayable.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/deployment/model/j2ee/Displayable.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Displayable.java 2 Sep 2003 17:04:20 -0000 1.2
+++ Displayable.java 1 Oct 2003 21:55:15 -0000 1.3
@@ -63,8 +63,8 @@
* @version $Revision$ $Date$
*/
public abstract class Displayable extends Describable {
- private DisplayName[] displayName;
- private Icon[] icon;
+ private DisplayName[] displayName = new DisplayName[0];
+ private Icon[] icon = new Icon[0];
public DisplayName[] getDisplayName() {
return displayName;
1.4 +9 -10
incubator-geronimo/modules/core/src/java/org/apache/geronimo/enterprise/deploy/provider/EjbJarDeploymentConfiguration.java
Index: EjbJarDeploymentConfiguration.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/enterprise/deploy/provider/EjbJarDeploymentConfiguration.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- EjbJarDeploymentConfiguration.java 5 Sep 2003 20:18:03 -0000
1.3
+++ EjbJarDeploymentConfiguration.java 1 Oct 2003 21:55:15 -0000
1.4
@@ -72,6 +72,7 @@
import org.apache.geronimo.enterprise.deploy.provider.jar.EjbJarRoot;
import org.apache.geronimo.xml.deployment.GeronimoEjbJarLoader;
import org.apache.geronimo.xml.deployment.LoaderUtil;
+import org.apache.geronimo.xml.deployment.GeronimoEjbJarStorer;
import
org.apache.geronimo.deployment.model.geronimo.ejb.GeronimoEjbJarDocument;
import org.xml.sax.SAXException;
@@ -137,14 +138,12 @@
}
public void save(OutputStream outputArchive) throws
ConfigurationException {
-// try {
-// new Marshaller(new
OutputStreamWriter(outputArchive)).marshal(EjbConverter.storeDConfigBeans(geronimoDD));
-// } catch(MarshalException e) {
-// throw new ConfigurationException("Unable to save
configuration: "+e.getMessage());
-// } catch(ValidationException e) {
-// throw new ConfigurationException("Unable to save
configuration: "+e.getMessage());
-// } catch(IOException e) {
-// throw new ConfigurationException("Unable to save
configuration: "+e.getMessage());
-// }
+ GeronimoEjbJarDocument doc = new GeronimoEjbJarDocument();
+ doc.setEjbJar(EjbConverter.storeDConfigBeans(geronimoDD));
+ try {
+ GeronimoEjbJarStorer.store(doc, new
OutputStreamWriter(outputArchive));
+ } catch(IOException e) {
+ throw new ConfigurationException("Unable to store
Geronimo-specific EJB deployment information", e);
+ }
}
}
1.8 +230 -66
incubator-geronimo/modules/core/src/java/org/apache/geronimo/enterprise/deploy/provider/jar/EjbConverter.java
Index: EjbConverter.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/enterprise/deploy/provider/jar/EjbConverter.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- EjbConverter.java 29 Sep 2003 14:46:00 -0000 1.7
+++ EjbConverter.java 1 Oct 2003 21:55:15 -0000 1.8
@@ -68,6 +68,13 @@
import org.apache.geronimo.deployment.model.geronimo.ejb.EjbJar;
import org.apache.geronimo.deployment.model.geronimo.ejb.EnterpriseBeans;
import org.apache.geronimo.deployment.model.ejb.Ejb;
+import org.apache.geronimo.deployment.model.ejb.SecurityIdentity;
+import org.apache.geronimo.deployment.model.ejb.ActivationConfig;
+import org.apache.geronimo.deployment.model.ejb.ActivationConfigProperty;
+import org.apache.geronimo.deployment.model.ejb.RpcBean;
+import org.apache.geronimo.deployment.model.ejb.CmpField;
+import org.apache.geronimo.deployment.model.ejb.Query;
+import org.apache.geronimo.deployment.model.ejb.QueryMethod;
import org.apache.geronimo.deployment.model.geronimo.ejb.MessageDriven;
import org.apache.geronimo.deployment.model.geronimo.ejb.Entity;
import org.apache.geronimo.deployment.model.geronimo.ejb.Session;
@@ -78,10 +85,25 @@
import org.apache.geronimo.deployment.model.geronimo.j2ee.ResourceEnvRef;
import org.apache.geronimo.deployment.model.geronimo.j2ee.SecurityRoleRef;
import org.apache.geronimo.deployment.model.j2ee.EnvEntry;
+import org.apache.geronimo.deployment.model.j2ee.RunAs;
+import org.apache.geronimo.deployment.model.j2ee.Describable;
+import org.apache.geronimo.deployment.model.j2ee.Description;
+import org.apache.geronimo.deployment.model.j2ee.Displayable;
+import org.apache.geronimo.deployment.model.j2ee.DisplayName;
+import org.apache.geronimo.deployment.model.j2ee.Icon;
/**
* Maps DConfigBeans to POJOs and vice versa.
*
+ * When converting POJOs to DConfigBeans, we ignore everything except the
+ * Geronimo-specific content. That way, we don't have to listen on changes
+ * on every single element in the whole standard DD.
+ *
+ * When converting DConfigBeans to POJOs, we use the matching DDBeans to
+ * look up all the info that isn't covered in the Geronimo DD for each
+ * DConfigBean. Note this means that the standard DD content may be out of
+ * sync when loaded, but they'll be cleaned up when the DD is saved.
+ *
* @version $Revision$ $Date$
*/
public class EjbConverter {
@@ -98,11 +120,13 @@
}
public static EjbJar storeDConfigBeans(EjbJarRoot root) throws
ConfigurationException {
- EjbJar jar = new EjbJar();
- jar.setEnterpriseBeans(new EnterpriseBeans());
if(root == null || root.getEjbJar() == null) {
throw new ConfigurationException("Insufficient configuration
information to save.");
}
+ EjbJar jar = new EjbJar();
+
jar.setVersion(root.getEjbJar().getDDBean().getAttributeValue("version"));
+ loadDescribable(root.getEjbJar().getDDBean(), jar);
+ jar.setEnterpriseBeans(new EnterpriseBeans());
EnterpriseBeansBean beans = root.getEjbJar().getEnterpriseBeans();
if(beans == null) {
throw new ConfigurationException("Insufficient configuration
information to save.");
@@ -114,12 +138,80 @@
}
private static void storeEjb(Ejb dest, BaseEjbBean bean) {
+ loadDisplayable(bean.getDDBean(), dest);
dest.setEJBName(bean.getEjbName());
+ dest.setEJBClass(getText(bean.getDDBean().getText("ejb-class")));
+ DDBean list[] = bean.getDDBean().getChildBean("security-identity");
+ if(list.length == 1) {
+ DDBean id = list[0];
+ SecurityIdentity sid = new SecurityIdentity();
+ loadDescribable(id, sid);
+ list = id.getChildBean("use-caller-identity");
+ if(list != null && list.length == 1) {
+ sid.setUseCallerIdentity(true);
+ } else {
+ sid.setUseCallerIdentity(false);
+ list = id.getChildBean("run-as");
+ if(list != null && list.length == 1) {
+ RunAs as = new RunAs();
+ loadDescribable(list[0], as);
+ as.setRoleName(getText(list[0].getText("role-name")));
+ sid.setRunAs(as);
+ }
+ }
+ dest.setSecurityIdentity(sid);
+ }
storeEnvEntries(dest, bean.getEnvEntry().iterator());
storeEjbRefs(dest, bean.getEjbRef().iterator());
storeEjbLocalRefs(dest, bean.getEjbLocalRef().iterator());
storeResourceRefs(dest, bean.getResourceRef().iterator());
storeResourceEnvRefs(dest, bean.getResourceEnvRef().iterator());
+ //todo: message-destination-refs, service-refs
+ }
+
+ public static void loadDescribable(DDBean base, Describable desc) {
+ DDBean[] ds = base.getChildBean("description");
+ Description[] out = new Description[ds.length];
+ for(int i=0; i<ds.length; i++) {
+ Description d = new Description();
+ d.setLang(ds[i].getAttributeValue("lang"));
+ d.setContent(ds[i].getText());
+ out[i] = d;
+ }
+ desc.setDescription(out);
+ }
+
+ public static void loadDisplayable(DDBean base, Displayable disp) {
+ loadDescribable(base, disp);
+ DDBean[] ds = base.getChildBean("display-name");
+ DisplayName[] out = new DisplayName[ds.length];
+ for(int i=0; i<ds.length; i++) {
+ DisplayName d = new DisplayName();
+ d.setLang(ds[i].getAttributeValue("lang"));
+ d.setContent(ds[i].getText());
+ out[i] = d;
+ }
+ disp.setDisplayName(out);
+ ds = base.getChildBean("icon");
+ Icon[] is = new Icon[ds.length];
+ for(int i=0; i<ds.length; i++) {
+ Icon ic = new Icon();
+ ic.setLang(ds[i].getAttributeValue("lang"));
+ ic.setLargeIcon(getText(ds[i].getText("large-icon")));
+ ic.setSmallIcon(getText(ds[i].getText("small-icon")));
+ is[i] = ic;
+ }
+ disp.setIcon(is);
+ }
+
+ private static String getText(String[] text) {
+ if(text == null || text.length == 0) {
+ return null;
+ } else if(text.length == 1) {
+ return text[0];
+ } else {
+ throw new IllegalArgumentException();
+ }
}
private static void storeMessageDriven(EnterpriseBeans beans, Iterator
iterator) {
@@ -128,6 +220,26 @@
MessageDrivenBean bean = (MessageDrivenBean)iterator.next();
MessageDriven md = new MessageDriven();
storeEjb(md, bean);
+ DDBean ddb = bean.getDDBean();
+ md.setMessagingType(getText(ddb.getText("messaging-type")));
+ md.setTransactionType(getText(ddb.getText("transaction-type")));
+
md.setMessageDestinationType(getText(ddb.getText("message-destination-type")));
+
md.setMessageDestinationLink(getText(ddb.getText("message-destination-link")));
+ DDBean[] foo = ddb.getChildBean("activation-config");
+ if(foo != null && foo.length == 1) {
+ ActivationConfig config = new ActivationConfig();
+ loadDescribable(foo[0], config);
+ foo = foo[0].getChildBean("activation-config-property");
+ ActivationConfigProperty[] props = new
ActivationConfigProperty[foo.length];
+ for(int i=0; i<foo.length; i++) {
+ ActivationConfigProperty prop = new
ActivationConfigProperty();
+
prop.setActivationConfigPropertyName(getText(foo[i].getText("activation-config-property-name")));
+
prop.setActivationConfigPropertyValue(getText(foo[i].getText("activation-config-property-value")));
+ props[i] = prop;
+ }
+ config.setActivationConfigProperty(props);
+ md.setActivationConfig(config);
+ }
list.add(md);
}
beans.setMessageDriven((MessageDriven[])list.toArray(new
MessageDriven[list.size()]));
@@ -139,6 +251,48 @@
EntityBean bean = (EntityBean)iterator.next();
Entity e = new Entity();
storeEjb(e, bean);
+ DDBean ddb = bean.getDDBean();
+ e.setHome(getText(ddb.getText("home")));
+ e.setRemote(getText(ddb.getText("remote")));
+ e.setLocalHome(getText(ddb.getText("local-home")));
+ e.setLocal(getText(ddb.getText("local")));
+ e.setPersistenceType(getText(ddb.getText("persistence-type")));
+ e.setPrimKeyClass(getText(ddb.getText("prim-key-class")));
+ e.setReentrant(getText(ddb.getText("reentrant")));
+ e.setCmpVersion(getText(ddb.getText("cmp-version")));
+
e.setAbstractSchemaName(getText(ddb.getText("abstract-schema-name")));
+ e.setPrimkeyField(getText(ddb.getText("primkey-field")));
+ DDBean[] foo = ddb.getChildBean("cmp-field");
+ CmpField[] fields = new CmpField[foo.length];
+ for(int i = 0; i < foo.length; i++) {
+ CmpField field = new CmpField();
+ loadDescribable(foo[i], field);
+ field.setFieldName(getText(foo[i].getText("field-name")));
+ fields[i] = field;
+ }
+ e.setCmpField(fields);
+ foo = ddb.getChildBean("query");
+ Query[] queries = new Query[foo.length];
+ for(int i = 0; i < foo.length; i++) {
+ Query query = new Query();
+ loadDescribable(foo[i], query);
+ query.setEjbQl(getText(foo[i].getText("ejb-ql")));
+
query.setResultTypeMapping(getText(foo[i].getText("result-type-mapping")));
+ DDBean[] bar = foo[i].getChildBean("query-method");
+ if(bar.length == 1) {
+ QueryMethod method = new QueryMethod();
+
method.setMethodName(getText(bar[0].getText("method-name")));
+ bar = bar[0].getChildBean("method-params/method-param");
+ String[] params = new String[bar.length];
+ for(int j = 0; j < bar.length; j++) {
+ params[j] = bar[j].getText();
+ }
+ method.setMethodParam(params);
+ query.setQueryMethod(method);
+ }
+ queries[i] = query;
+ }
+ e.setQuery(queries);
e.setJndiName(bean.getJndiName());
storeSecurityRoleRefs(e, bean.getSecurityRoleRef().iterator());
list.add(e);
@@ -152,6 +306,14 @@
SessionBean bean = (SessionBean)iterator.next();
Session s = new Session();
storeEjb(s, bean);
+ DDBean ddb = bean.getDDBean();
+ s.setHome(getText(ddb.getText("home")));
+ s.setRemote(getText(ddb.getText("remote")));
+ s.setLocalHome(getText(ddb.getText("local-home")));
+ s.setLocal(getText(ddb.getText("local")));
+ s.setServiceEndpoint(getText(ddb.getText("service-endpoint")));
+ s.setSessionType(getText(ddb.getText("session-type")));
+ s.setTransactionType(getText(ddb.getText("transaction-type")));
s.setJndiName(bean.getJndiName());
storeSecurityRoleRefs(s, bean.getSecurityRoleRef().iterator());
list.add(s);
@@ -163,13 +325,14 @@
List list = new ArrayList();
while(it.hasNext()) {
EnvEntryBean bean = (EnvEntryBean)it.next();
- String standard =
bean.getDDBean().getText(EnvEntryBean.ENV_ENTRY_VALUE_XPATH)[0];
- if(isValid(bean.getEnvEntryValue()) && (standard == null ||
!standard.equals(bean.getEnvEntryValue()))) {
- EnvEntry e = new EnvEntry();
- e.setEnvEntryName(bean.getEnvEntryName());
- e.setEnvEntryValue(bean.getEnvEntryValue());
- list.add(e);
- }
+ DDBean ddb = bean.getDDBean();
+ String standard =
getText(ddb.getText(EnvEntryBean.ENV_ENTRY_VALUE_XPATH));
+ EnvEntry e = new EnvEntry();
+ loadDescribable(ddb, e);
+ e.setEnvEntryName(bean.getEnvEntryName());
+ e.setEnvEntryType(getText(ddb.getText("env-entry-type")));
+ e.setEnvEntryValue(bean.getEnvEntryValue() == null ? standard :
bean.getEnvEntryValue());
+ list.add(e);
}
dest.setEnvEntry((EnvEntry[])list.toArray(new
EnvEntry[list.size()]));
}
@@ -178,9 +341,15 @@
List outer = new ArrayList();
while(it.hasNext()) {
EjbRefBean bean = (EjbRefBean)it.next();
- if(isValid(bean.getJndiName())) {
- EjbRef ref = new EjbRef();
- ref.setEJBRefName(bean.getEjbRefName());
+ EjbRef ref = new EjbRef();
+ DDBean ddb = bean.getDDBean();
+ loadDescribable(ddb, ref);
+ ref.setEJBRefName(bean.getEjbRefName());
+ ref.setEJBRefType(getText(ddb.getText("ejb-ref-type")));
+ ref.setHome(getText(ddb.getText("home")));
+ ref.setRemote(getText(ddb.getText("remote")));
+ ref.setEJBLink(getText(ddb.getText("ejb-link")));
+ if(ref.getEJBLink() == null) {
ref.setJndiName(bean.getJndiName());
ContextParam[] params = bean.getContextParam();
List list = new ArrayList();
@@ -195,8 +364,8 @@
if(list.size() > 0) {
ref.setJndiContextParam((JndiContextParam[])list.toArray(new
JndiContextParam[list.size()]));
}
- outer.add(ref);
}
+ outer.add(ref);
}
dest.setEJBRef((EjbRef[])outer.toArray(new EjbRef[outer.size()]));
}
@@ -205,9 +374,15 @@
List outer = new ArrayList();
while(it.hasNext()) {
EjbLocalRefBean bean = (EjbLocalRefBean)it.next();
- if(isValid(bean.getJndiName())) {
- EjbLocalRef ref = new EjbLocalRef();
- ref.setEJBRefName(bean.getEjbRefName());
+ EjbLocalRef ref = new EjbLocalRef();
+ DDBean ddb = bean.getDDBean();
+ loadDescribable(ddb, ref);
+ ref.setEJBRefName(bean.getEjbRefName());
+ ref.setEJBRefType(getText(ddb.getText("ejb-ref-type")));
+ ref.setLocalHome(getText(ddb.getText("local-home")));
+ ref.setLocal(getText(ddb.getText("local")));
+ ref.setEJBLink(getText(ddb.getText("ejb-link")));
+ if(ref.getEJBLink() == null) {
ref.setJndiName(bean.getJndiName());
ContextParam[] params = bean.getContextParam();
List list = new ArrayList();
@@ -222,8 +397,8 @@
if(list.size() > 0) {
ref.setJndiContextParam((JndiContextParam[])list.toArray(new
JndiContextParam[list.size()]));
}
- outer.add(ref);
}
+ outer.add(ref);
}
dest.setEJBLocalRef((EjbLocalRef[])outer.toArray(new
EjbLocalRef[outer.size()]));
}
@@ -232,25 +407,28 @@
List outer = new ArrayList();
while(it.hasNext()) {
ResourceRefBean bean = (ResourceRefBean)it.next();
- if(isValid(bean.getJndiName())) {
- ResourceRef ref = new ResourceRef();
- ref.setResRefName(bean.getResRefName());
- ref.setJndiName(bean.getJndiName());
- ContextParam[] params = bean.getContextParam();
- List list = new ArrayList();
- for(int i=0; i<params.length; i++) {
- if(isValid(params[i].getParamName()) &&
isValid(params[i].getParamValue())) {
- JndiContextParam jcp = new JndiContextParam();
- jcp.setParamName(params[i].getParamName());
- jcp.setParamValue(params[i].getParamValue());
- list.add(jcp);
- }
+ ResourceRef ref = new ResourceRef();
+ DDBean ddb = bean.getDDBean();
+ loadDescribable(ddb, ref);
+ ref.setResRefName(bean.getResRefName());
+ ref.setResType(getText(ddb.getText("res-type")));
+ ref.setResAuth(getText(ddb.getText("res-auth")));
+
ref.setResSharingScope(getText(ddb.getText("res-sharing-scope")));
+ ref.setJndiName(bean.getJndiName());
+ ContextParam[] params = bean.getContextParam();
+ List list = new ArrayList();
+ for(int i=0; i<params.length; i++) {
+ if(isValid(params[i].getParamName()) &&
isValid(params[i].getParamValue())) {
+ JndiContextParam jcp = new JndiContextParam();
+ jcp.setParamName(params[i].getParamName());
+ jcp.setParamValue(params[i].getParamValue());
+ list.add(jcp);
}
- if(list.size() > 0) {
-
ref.setJndiContextParam((JndiContextParam[])list.toArray(new
JndiContextParam[list.size()]));
- }
- outer.add(ref);
}
+ if(list.size() > 0) {
+ ref.setJndiContextParam((JndiContextParam[])list.toArray(new
JndiContextParam[list.size()]));
+ }
+ outer.add(ref);
}
dest.setResourceRef((ResourceRef[])outer.toArray(new
ResourceRef[outer.size()]));
}
@@ -259,42 +437,27 @@
List list = new ArrayList();
while(it.hasNext()) {
ResourceEnvRefBean bean = (ResourceEnvRefBean)it.next();
- if(isValid(bean.getJndiName())) {
- ResourceEnvRef ref = new ResourceEnvRef();
- ref.setResourceEnvRefName(bean.getResourceEnvRefName());
- ref.setJndiName(bean.getJndiName());
- list.add(ref);
- }
+ ResourceEnvRef ref = new ResourceEnvRef();
+ DDBean ddb = bean.getDDBean();
+ loadDescribable(ddb, ref);
+ ref.setResourceEnvRefName(bean.getResourceEnvRefName());
+
ref.setResourceEnvRefType(getText(ddb.getText("resource-env-ref-type")));
+ ref.setJndiName(bean.getJndiName());
+ list.add(ref);
}
dest.setResourceEnvRef((ResourceEnvRef[])list.toArray(new
ResourceEnvRef[list.size()]));
}
- private static void storeSecurityRoleRefs(Session dest, Iterator it) {
+ private static void storeSecurityRoleRefs(RpcBean dest, Iterator it) {
List list = new ArrayList();
while(it.hasNext()) {
SecurityRoleRefBean bean = (SecurityRoleRefBean)it.next();
- String standard =
bean.getDDBean().getText(SecurityRoleRefBean.ROLE_LINK_XPATH)[0];
- if(isValid(bean.getRoleLink()) && (standard == null ||
!standard.equals(bean.getRoleLink()))) {
- SecurityRoleRef ref = new SecurityRoleRef();
- ref.setRoleName(bean.getRoleName());
- ref.setRoleLink(bean.getRoleLink());
- list.add(ref);
- }
- }
- dest.setSecurityRoleRef((SecurityRoleRef[])list.toArray(new
SecurityRoleRef[list.size()]));
- }
-
- private static void storeSecurityRoleRefs(Entity dest, Iterator it) {
- List list = new ArrayList();
- while(it.hasNext()) {
- SecurityRoleRefBean bean = (SecurityRoleRefBean)it.next();
- String standard =
bean.getDDBean().getText(SecurityRoleRefBean.ROLE_LINK_XPATH)[0];
- if(isValid(bean.getRoleLink()) && (standard == null ||
!standard.equals(bean.getRoleLink()))) {
- SecurityRoleRef ref = new SecurityRoleRef();
- ref.setRoleName(bean.getRoleName());
- ref.setRoleLink(bean.getRoleLink());
- list.add(ref);
- }
+ DDBean ddb = bean.getDDBean();
+ String standard =
getText(ddb.getText(SecurityRoleRefBean.ROLE_LINK_XPATH));
+ SecurityRoleRef ref = new SecurityRoleRef();
+ ref.setRoleName(bean.getRoleName());
+ ref.setRoleLink(bean.getRoleLink() == null ? standard :
bean.getRoleLink());
+ list.add(ref);
}
dest.setSecurityRoleRef((SecurityRoleRef[])list.toArray(new
SecurityRoleRef[list.size()]));
}
@@ -348,7 +511,7 @@
SessionBean bean = (SessionBean)root.getDConfigBean(match);
assignEjb(bean, sessions[i], match);
//session-specific content
- bean.setJndiName(bean.getJndiName());
+ bean.setJndiName(sessions[i].getJndiName());
assignSecurityRoleRefs(bean,
sessions[i].getGeronimoSecurityRoleRef(),
match.getChildBean(EntityBean.SECURITY_ROLE_REF_XPATH));
}
for(int i = 0; i < childBean.length; i++) {
@@ -380,7 +543,7 @@
EntityBean bean = (EntityBean)root.getDConfigBean(match);
assignEjb(bean, entities[i], match);
//entity-specific content
- bean.setJndiName(bean.getJndiName());
+ bean.setJndiName(entities[i].getJndiName());
assignSecurityRoleRefs(bean,
entities[i].getGeronimoSecurityRoleRef(),
match.getChildBean(EntityBean.SECURITY_ROLE_REF_XPATH));
}
for(int i = 0; i < childBean.length; i++) {
@@ -400,6 +563,7 @@
assignEjbLocalRefs(dest, (EjbLocalRef[])bean.getEJBLocalRef(),
standard.getChildBean(BaseEjbBean.EJB_LOCAL_REF_XPATH));
assignResourceRefs(dest, (ResourceRef[])bean.getResourceRef(),
standard.getChildBean(BaseEjbBean.RESOURCE_REF_XPATH));
assignResourceEnvRefs(dest,
(ResourceEnvRef[])bean.getResourceEnvRef(),
standard.getChildBean(BaseEjbBean.RESOURCE_ENV_REF_XPATH));
+ //todo: message destination refs, service refs
}
private static void assignEnvEntries(BaseEjbBean dest, EnvEntry[]
entries, DDBean[] beans) throws ConfigurationException {