Update of /cvsroot/commonjava/commonjava-projects/commonjava-enterprise-services/src/java/org/commonjava/j2ee/services/config/xmlparse
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26828/src/java/org/commonjava/j2ee/services/config/xmlparse
Modified Files:
EnterpriseConfigParser.java
Removed Files:
JdbcConfigParser.java JmsConfigParser.java
EjbConfigParser.java
Log Message:
updated documentation in project.xml files, and added functionality to:
Console:
- provide convenient way to prompt the user for more information
Config:
- Provide snap-in container stacking, or scoping
- Provide a JBoss service implementation of a snap-in container
Probably other things, but I don't honestly remember everything...
Index: EnterpriseConfigParser.java
===================================================================
RCS file: /cvsroot/commonjava/commonjava-projects/commonjava-enterprise-services/src/java/org/commonjava/j2ee/services/config/xmlparse/EnterpriseConfigParser.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- EnterpriseConfigParser.java 7 Oct 2003 19:40:38 -0000 1.1
+++ EnterpriseConfigParser.java 18 Feb 2004 06:12:46 -0000 1.2
@@ -6,11 +6,14 @@
import org.commonjava.config.jndi.JndiConfig;
import org.commonjava.config.jndi.JndiConfigConsumer;
+import org.commonjava.config.snapin.SnapInContainer;
import org.commonjava.j2ee.services.config.EnterpriseConfiguration;
+import org.commonjava.opl.ElementInfo;
import org.commonjava.opl.NodeParser;
import org.commonjava.opl.OPLContext;
import org.commonjava.opl.OPLModelRoot;
import org.commonjava.opl.ParseException;
+import org.commonjava.util.Strings;
/** Parse a J2EE configuration specification into an EnterpriseConfiguration
* object.
@@ -21,6 +24,12 @@
implements JndiConfigConsumer, OPLModelRoot
{
+ private static final String EJB_REF_ID = "ejbRefId";
+ private static final String JMS_REF_ID = "jmsRefId";
+ private static final String SERVICE_REF_ID = "serviceRefId";
+ private static final String JDBC_REF_ID = "jdbcRefId";
+ private static final String JMS_QUEUE_CONNECTION_FACTORY_BINDING = "qConnFactoryBinding";
+
private EnterpriseConfiguration config = new EnterpriseConfiguration();
/** Create a new Parser.
@@ -54,27 +63,6 @@
config.addJndiConfig(cfg);
}
- /** Set the refId of the JndiConfig object to use for looking up EJBs.
- * @param refId The reference to the JndiConfig object.
- */
- public void setEjbRefId(String refId) {
- config.setEjbRefId(refId);
- }
-
- /** Set the refId of the JndiConfig object to use for looking up DataSources.
- * @param refId The reference to the JndiConfig object.
- */
- public void setJdbcRefId(String refId) {
- config.setJdbcRefId(refId);
- }
-
- /** Set the refId of the JndiConfig object to use for looking up Queues and Topics.
- * @param refId The reference to the JndiConfig object.
- */
- public void setJmsRefId(String refId) {
- config.setJmsRefId(refId);
- }
-
/** Return the parsed EnterpriseConfiguration object.
* @return the parsed configuration.
* @throws ParseException
@@ -84,12 +72,32 @@
return config;
}
- /** Set the JNDI binding for the JMS QueueConnectionFactory to use in gaining
- * access to a JMS queue.
- * @param binding The JNDI binding for the QueueConnectionFactory
+ /** Look for a SnapInContainer in the ancestor stack, and if found, add the embedded
+ * enterprise config to it.
+ * @see org.commonjava.opl.NodeParser#doAfterChildren(org.commonjava.opl.ElementInfo, java.lang.String)
*/
- public void setJmsQueueConnectionFactoryBinding(String binding) {
- config.setJmsQueueConnectionFactoryBinding(binding);
+ protected void doAfterChildren(ElementInfo element, String body)
+ throws ParseException
+ {
+ String ejbId = getAttribute(EJB_REF_ID, element, true);
+ if(!Strings.empty(ejbId)){config.setEjbRefId(ejbId);}
+
+ String jmsId = getAttribute(JMS_REF_ID, element, true);
+ if(!Strings.empty(jmsId)){config.setJmsRefId(jmsId);}
+
+ String serviceId = getAttribute(SERVICE_REF_ID, element, true);
+ if(!Strings.empty(serviceId)){config.setServiceRefId(serviceId);}
+
+ String jdbcId = getAttribute(JDBC_REF_ID, element, true);
+ if(!Strings.empty(jdbcId)){config.setJdbcRefId(jdbcId);}
+
+ String qConnFac = getAttribute(JMS_QUEUE_CONNECTION_FACTORY_BINDING, element, true);
+ if(!Strings.empty(qConnFac)){config.setJmsQueueConnectionFactoryBinding(qConnFac);}
+
+ SnapInContainer container = (SnapInContainer)findAncestorOfType(SnapInContainer.class, false);
+ if(container != null){
+ container.addSnapIn(config);
+ }
}
}
--- JdbcConfigParser.java DELETED ---
--- JmsConfigParser.java DELETED ---
--- EjbConfigParser.java DELETED ---
|