You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by dj...@apache.org on 2004/05/24 21:12:55 UTC
cvs commit: incubator-geronimo/modules/jetty/src/java/org/apache/geronimo/jetty/deployment JettyModuleBuilder.java
djencks 2004/05/24 12:12:55
Modified: modules/jetty/src/java/org/apache/geronimo/jetty
JettyWebApplicationContext.java
modules/jetty/src/java/org/apache/geronimo/jetty/deployment
JettyModuleBuilder.java
Log:
extract res-sharing-scope and res-auth from xml and make available for connection requests
Revision Changes Path
1.14 +12 -5 incubator-geronimo/modules/jetty/src/java/org/apache/geronimo/jetty/JettyWebApplicationContext.java
Index: JettyWebApplicationContext.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/jetty/src/java/org/apache/geronimo/jetty/JettyWebApplicationContext.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- JettyWebApplicationContext.java 7 Apr 2004 19:22:15 -0000 1.13
+++ JettyWebApplicationContext.java 24 May 2004 19:12:55 -0000 1.14
@@ -69,7 +69,8 @@
private final UserTransactionImpl userTransaction;
// @todo get these from DD
- private final Set unshareableResources = Collections.EMPTY_SET;
+ private final Set unshareableResources;
+ private final Set applicationManagedSecurityResources;
private boolean contextPriorityClassLoader = false;
@@ -79,6 +80,8 @@
JettyContainer container,
ReadOnlyContext compContext,
String policyContextID,
+ Set unshareableResources,
+ Set applicationManagedSecurityResources,
TransactionManager txManager,
TrackedConnectionAssociator associator,
UserTransactionImpl userTransaction) {
@@ -88,6 +91,8 @@
this.container = container;
this.componentContext = compContext;
this.policyContextID = policyContextID;
+ this.unshareableResources = unshareableResources;
+ this.applicationManagedSecurityResources = applicationManagedSecurityResources;
this.txManager = txManager;
this.associator = associator;
this.userTransaction = userTransaction;
@@ -156,7 +161,7 @@
TransactionContext.setContext(new UnspecifiedTransactionContext());
}
try {
- oldConnectorContext = associator.enter(new DefaultComponentContext(), unshareableResources);
+ oldConnectorContext = associator.enter(new DefaultComponentContext(), unshareableResources, applicationManagedSecurityResources);
} catch (ResourceException e) {
throw new RuntimeException(e);
}
@@ -226,14 +231,16 @@
infoFactory.addAttribute("ContextPriorityClassLoader", true);
infoFactory.addAttribute("ComponentContext", true);
infoFactory.addAttribute("PolicyContextID", true);
+ infoFactory.addAttribute("UnshareableResources", true);
+ infoFactory.addAttribute("ApplicationManagedSecurityResources", true);
infoFactory.addAttribute("UserTransaction", true);
infoFactory.addReference("Configuration", ConfigurationParent.class);
infoFactory.addReference("JettyContainer", JettyContainer.class);
infoFactory.addReference("TransactionManager", TransactionManager.class);
infoFactory.addReference("TrackedConnectionAssociator", TrackedConnectionAssociator.class);
infoFactory.setConstructor(new GConstructorInfo(
- Arrays.asList(new Object[]{"Configuration", "URI", "JettyContainer", "ComponentContext", "PolicyContextID", "TransactionManager", "TrackedConnectionAssociator", "UserTransaction"}),
- Arrays.asList(new Object[]{ConfigurationParent.class, URI.class, JettyContainer.class, ReadOnlyContext.class, String.class, TransactionManager.class, TrackedConnectionAssociator.class, UserTransactionImpl.class})));
+ Arrays.asList(new Object[]{"Configuration", "URI", "JettyContainer", "ComponentContext", "PolicyContextID", "UnshareableResources", "ApplicationManagedSecurityResources", "TransactionManager", "TrackedConnectionAssociator", "UserTransaction"}),
+ Arrays.asList(new Object[]{ConfigurationParent.class, URI.class, JettyContainer.class, ReadOnlyContext.class, String.class, Set.class, Set.class, TransactionManager.class, TrackedConnectionAssociator.class, UserTransactionImpl.class})));
GBEAN_INFO = infoFactory.getBeanInfo();
}
1.2 +33 -1 incubator-geronimo/modules/jetty/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
Index: JettyModuleBuilder.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/jetty/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- JettyModuleBuilder.java 19 May 2004 20:54:00 -0000 1.1
+++ JettyModuleBuilder.java 24 May 2004 19:12:55 -0000 1.2
@@ -30,11 +30,17 @@
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
+import java.util.Set;
+import java.util.HashSet;
import java.util.jar.JarFile;
import java.util.jar.JarInputStream;
import java.util.zip.ZipEntry;
import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
+import javax.management.AttributeNotFoundException;
+import javax.management.ReflectionException;
+import javax.management.InvalidAttributeValueException;
+import javax.management.MBeanException;
import javax.naming.NamingException;
import javax.transaction.UserTransaction;
@@ -65,6 +71,7 @@
import org.apache.geronimo.xbeans.j2ee.EnvEntryType;
import org.apache.geronimo.xbeans.j2ee.WebAppDocument;
import org.apache.geronimo.xbeans.j2ee.WebAppType;
+import org.apache.geronimo.xbeans.j2ee.ResourceRefType;
import org.apache.xmlbeans.XmlException;
import org.apache.xmlbeans.XmlObject;
@@ -220,6 +227,7 @@
gbean.setAttribute("PolicyContextID", null);
gbean.setAttribute("ComponentContext", compContext);
gbean.setAttribute("UserTransaction", userTransaction);
+ setResourceEnvironment(gbean, webApp.getResourceRefArray(), jettyWebApp.getResourceRefArray());
gbean.setReferencePatterns("Configuration", Collections.singleton(ConfigurationManager.getConfigObjectName(configID)));
gbean.setReferencePatterns("JettyContainer", Collections.singleton(new ObjectName("*:type=WebContainer,container=Jetty"))); // @todo configurable
gbean.setReferencePatterns("TransactionManager", Collections.singleton(new ObjectName("*:type=TransactionManager,*")));
@@ -332,6 +340,30 @@
}
}
}
+
+ private void setResourceEnvironment(GBeanMBean bean, ResourceRefType[] resourceRefArray, JettyLocalRefType[] jettyResourceRefArray) throws AttributeNotFoundException, ReflectionException, InvalidAttributeValueException, MBeanException {
+ Map openejbNames = new HashMap();
+ for (int i = 0; i < jettyResourceRefArray.length; i++) {
+ JettyLocalRefType jettyLocalRefType = jettyResourceRefArray[i];
+ openejbNames.put(jettyLocalRefType.getRefName(), jettyLocalRefType.getTargetName());
+ }
+ Set unshareableResources = new HashSet();
+ Set applicationManagedSecurityResources = new HashSet();
+ for (int i = 0; i < resourceRefArray.length; i++) {
+ ResourceRefType resourceRefType = resourceRefArray[i];
+ String name = (String)openejbNames.get(resourceRefType.getResRefName().getStringValue());
+ if ("Unshareable".equals(resourceRefType.getResSharingScope().getStringValue())) {
+ unshareableResources.add(name);
+ }
+ if ("Application".equals(resourceRefType.getResAuth().getStringValue())) {
+ applicationManagedSecurityResources.add(name);
+ }
+ }
+ bean.setAttribute("UnshareableResources", unshareableResources);
+ bean.setAttribute("ApplicationManagedSecurityResources", applicationManagedSecurityResources);
+ }
+
+
private static String getJ2eeStringValue(org.apache.geronimo.xbeans.j2ee.String string) {
if (string == null) {