[jboss-cvs] JBossAS SVN: r58231 - in trunk/server/src/main/org/jboss: deployment metadata
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Nov 9 08:52:16 EST 2006
Author: alex.loubyansky at jboss.com
Date: 2006-11-09 08:52:10 -0500 (Thu, 09 Nov 2006)
New Revision: 58231
Modified:
trunk/server/src/main/org/jboss/deployment/JBossEjbObjectFactory.java
trunk/server/src/main/org/jboss/metadata/ActivationConfigPropertyMetaData.java
trunk/server/src/main/org/jboss/metadata/BeanMetaData.java
trunk/server/src/main/org/jboss/metadata/CacheInvalidationConfigMetaData.java
trunk/server/src/main/org/jboss/metadata/EjbPortComponentMetaData.java
trunk/server/src/main/org/jboss/metadata/EjbRefMetaData.java
trunk/server/src/main/org/jboss/metadata/IorSecurityConfigMetaData.java
trunk/server/src/main/org/jboss/metadata/MethodAttributes.java
Log:
more parsing
Modified: trunk/server/src/main/org/jboss/deployment/JBossEjbObjectFactory.java
===================================================================
--- trunk/server/src/main/org/jboss/deployment/JBossEjbObjectFactory.java 2006-11-09 12:16:30 UTC (rev 58230)
+++ trunk/server/src/main/org/jboss/deployment/JBossEjbObjectFactory.java 2006-11-09 13:52:10 UTC (rev 58231)
@@ -33,6 +33,14 @@
import org.jboss.metadata.ClusterConfigMetaData;
import org.jboss.metadata.EntityMetaData;
import org.jboss.metadata.MessageDrivenMetaData;
+import org.jboss.metadata.EjbRefMetaData;
+import org.jboss.metadata.SecurityIdentityMetaData;
+import org.jboss.metadata.MethodAttributes;
+import org.jboss.metadata.IorSecurityConfigMetaData;
+import org.jboss.metadata.CacheInvalidationConfigMetaData;
+import org.jboss.metadata.EjbPortComponentMetaData;
+import org.jboss.metadata.SessionMetaData;
+import org.jboss.metadata.ActivationConfigPropertyMetaData;
import org.jboss.xb.binding.UnmarshallingContext;
import org.jboss.mx.util.ObjectNameFactory;
import org.xml.sax.Attributes;
@@ -158,7 +166,61 @@
// TODO: how is being associated with the bean metadata
return child;
}
-
+ else if(localName.equals("invoker-bindings"))
+ {
+ child = bean;
+ }
+ else if(localName.equals("invoker"))
+ {
+ child = new InvokerMetaData(bean.metaData);
+ }
+ else if(localName.equals("security-identity"))
+ {
+ child = bean.metaData.getSecurityIdentity();
+ if(child == null)
+ {
+ throw new IllegalStateException("security-identity in jboss.xml has no match in ejb-jar.xml for " + bean.metaData.getEjbName());
+ }
+ }
+ else if(localName.equals("ejb-timeout-identity"))
+ {
+ child = new SecurityIdentityMetaData();
+ }
+ else if(localName.equals("method-attributes"))
+ {
+ child = bean;
+ }
+ else if(localName.equals("method"))
+ {
+ child = new MethodAttributes();
+ }
+ else if(localName.equals("cluster-config"))
+ {
+ ClusterConfigMetaData cc = new ClusterConfigMetaData();
+ cc.init(bean.metaData);
+ }
+ else if(localName.equals("ior-security-config"))
+ {
+ child = new IorSecurityConfigMetaData();
+ }
+ else if(localName.equals("cache-invalidation-config"))
+ {
+ CacheInvalidationConfigMetaData config = new CacheInvalidationConfigMetaData();
+ config.init(bean.metaData);
+ child = config;
+ }
+ else if(localName.equals("port-component"))
+ {
+ child = new EjbPortComponentMetaData((SessionMetaData)bean.metaData);
+ }
+ else if(localName.equals("activation-config"))
+ {
+ child = bean;
+ }
+ else if(localName.equals("activation-config-property"))
+ {
+ return new ActivationConfigPropertyMetaData();
+ }
return child;
}
@@ -198,6 +260,34 @@
return new DomElement(child);
}
+ public Object newChild(InvokerMetaData invoker, UnmarshallingContext navigator,
+ String namespaceURI, String localName, Attributes attrs)
+ {
+ if(localName.equals("ejb-ref"))
+ {
+ return new InvokerMetaData.EjbRef();
+ }
+ return null;
+ }
+
+ public Object newChild(IorSecurityConfigMetaData invoker, UnmarshallingContext navigator,
+ String namespaceURI, String localName, Attributes attrs)
+ {
+ if(localName.equals("transport-config"))
+ {
+ return new IorSecurityConfigMetaData.TransportConfig();
+ }
+ else if(localName.equals("as-context"))
+ {
+ return new IorSecurityConfigMetaData.AsContext();
+ }
+ else if(localName.equals("sas-context"))
+ {
+ return new IorSecurityConfigMetaData.SasContext();
+ }
+ return null;
+ }
+
public void addChild(ApplicationMetaData parent, InvokerProxyBindingMetaData binding,
UnmarshallingContext navigator, String namespaceURI, String localName)
{
@@ -248,6 +338,96 @@
parent.element.appendChild(child.element);
}
+ public void addChild(BeanHolder parent, InvokerMetaData child,
+ UnmarshallingContext navigator, String namespaceURI, String localName)
+ {
+ String jndiName = child.jndiName;
+ if(jndiName == null)
+ {
+ jndiName = parent.metaData.getJndiName();
+ }
+ parent.metaData.addInvokerBinding(child.bindingName, jndiName);
+ }
+
+ public void addChild(BeanHolder parent, SecurityIdentityMetaData child,
+ UnmarshallingContext navigator, String namespaceURI, String localName)
+ {
+ if(localName.equals("ejb-timeout-identity"))
+ {
+ child.setRunAsRoleName("ejbTimeout");
+ if(child.getRunAsPrincipalName() == null)
+ {
+ child.getUseCallerIdentity();
+ }
+ parent.metaData.setEjbTimeoutIdentity(child);
+ }
+ }
+
+ public void addChild(BeanHolder parent, MethodAttributes child,
+ UnmarshallingContext navigator, String namespaceURI, String localName)
+ {
+ parent.metaData.getMethodAttributes().add(child);
+ }
+
+ public void addChild(BeanHolder parent, ClusterConfigMetaData child,
+ UnmarshallingContext navigator, String namespaceURI, String localName)
+ {
+ parent.metaData.setClusterConfig(child);
+ }
+
+ public void addChild(BeanHolder parent, IorSecurityConfigMetaData child,
+ UnmarshallingContext navigator, String namespaceURI, String localName)
+ {
+ parent.metaData.setIorSecurityConfig(child);
+ }
+
+ public void addChild(BeanHolder parent, CacheInvalidationConfigMetaData child,
+ UnmarshallingContext navigator, String namespaceURI, String localName)
+ {
+ ((EntityMetaData)parent.metaData).setCacheInvalidConfig(child);
+ }
+
+ public void addChild(BeanHolder parent, EjbPortComponentMetaData child,
+ UnmarshallingContext navigator, String namespaceURI, String localName)
+ {
+ ((SessionMetaData)parent.metaData).setPortComponent(child);
+ }
+
+ public void addChild(BeanHolder parent, ActivationConfigPropertyMetaData child,
+ UnmarshallingContext navigator, String namespaceURI, String localName)
+ {
+ ((MessageDrivenMetaData)parent.metaData).getActivationConfigProperties().put(child.getName(), child);
+ }
+
+ public void addChild(InvokerMetaData parent, InvokerMetaData.EjbRef child,
+ UnmarshallingContext navigator, String namespaceURI, String localName)
+ {
+ EjbRefMetaData ejbRef = parent.bean.getEjbRefByName(child.ejbRefName);
+ if(ejbRef == null)
+ {
+ throw new IllegalStateException("ejb-ref " + child.ejbRefName + " found in jboss.xml but not in ejb-jar.xml");
+ }
+ ejbRef.addInvokerBinding(parent.bindingName, child.jndiName);
+ }
+
+ public void addChild(IorSecurityConfigMetaData parent, IorSecurityConfigMetaData.TransportConfig child,
+ UnmarshallingContext navigator, String namespaceURI, String localName)
+ {
+ parent.setTransportConfig(child);
+ }
+
+ public void addChild(IorSecurityConfigMetaData parent, IorSecurityConfigMetaData.AsContext child,
+ UnmarshallingContext navigator, String namespaceURI, String localName)
+ {
+ parent.setAsContext(child);
+ }
+
+ public void addChild(IorSecurityConfigMetaData parent, IorSecurityConfigMetaData.SasContext child,
+ UnmarshallingContext navigator, String namespaceURI, String localName)
+ {
+ parent.setSasContext(child);
+ }
+
public void setValue(ApplicationMetaData amd,
UnmarshallingContext navigator, String namespaceURI, String localName,
String value)
@@ -297,6 +477,34 @@
}
}
+ public void setValue(InvokerMetaData md,
+ UnmarshallingContext navigator, String namespaceURI, String localName,
+ String value)
+ {
+ if(localName.equals("invoker-proxy-binding-name"))
+ {
+ md.bindingName = value;
+ }
+ else if(localName.equals("jndi-name"))
+ {
+ md.jndiName = value;
+ }
+ }
+
+ public void setValue(InvokerMetaData.EjbRef md,
+ UnmarshallingContext navigator, String namespaceURI, String localName,
+ String value)
+ {
+ if(localName.equals("ejb-ref-name"))
+ {
+ md.ejbRefName = value;
+ }
+ else if(localName.equals("jndi-name"))
+ {
+ md.jndiName = value;
+ }
+ }
+
public void setValue(BeanHolder bean,
UnmarshallingContext navigator, String namespaceURI, String localName,
String value)
@@ -488,6 +696,150 @@
dom.element.appendChild(textNode);
}
+ public void setValue(SecurityIdentityMetaData id,
+ UnmarshallingContext navigator, String namespaceURI, String localName,
+ String value)
+ {
+ if(localName.equals("run-as-principal") && value != null)
+ {
+ id.setRunAsPrincipalName(value);
+ }
+ }
+
+ public void setValue(MethodAttributes method,
+ UnmarshallingContext navigator, String namespaceURI, String localName,
+ String value)
+ {
+ if(localName.equals("method-name"))
+ {
+ method.setPattern(value);
+ }
+ else if(localName.equals("read-only"))
+ {
+ method.setReadOnly(Boolean.parseBoolean(value));
+ }
+ else if(localName.equals("idempotent"))
+ {
+ method.setIdempotent(Boolean.parseBoolean(value));
+ }
+ else if(localName.equals("transaction-timeout"))
+ {
+ method.setTxTimeout(Integer.parseInt(value));
+ }
+ }
+
+ public void setValue(IorSecurityConfigMetaData.TransportConfig parent,
+ UnmarshallingContext navigator, String namespaceURI, String localName,
+ String value)
+ {
+ if(localName.equals("integrity"))
+ {
+ parent.setIntegrity(value);
+ }
+ else if(localName.equals("confidentiality"))
+ {
+ parent.setConfidentiality(value);
+ }
+ else if(localName.equals("establish-trust-in-target"))
+ {
+ parent.setEstablishTrustInTarget(value);
+ }
+ else if(localName.equals("establish-trust-in-client"))
+ {
+ parent.setEstablishTrustInClient(value);
+ }
+ else if(localName.equals("detect-misordering"))
+ {
+ parent.setDetectMisordering(value);
+ }
+ else if(localName.equals("detect-replay"))
+ {
+ parent.setDetectReplay(value);
+ }
+ }
+
+ public void setValue(IorSecurityConfigMetaData.AsContext parent,
+ UnmarshallingContext navigator, String namespaceURI, String localName,
+ String value)
+ {
+ if(localName.equals("auth-method"))
+ {
+ parent.setAuthMethod(value);
+ }
+ else if(localName.equals("realm"))
+ {
+ parent.setRealm(value);
+ }
+ else if(localName.equals("required"))
+ {
+ parent.setRequired(Boolean.parseBoolean(value));
+ }
+ }
+
+ public void setValue(IorSecurityConfigMetaData.SasContext parent,
+ UnmarshallingContext navigator, String namespaceURI, String localName,
+ String value)
+ {
+ if(localName.equals("caller-propagation"))
+ {
+ parent.setCallerPropagation(value);
+ }
+ }
+
+ public void setValue(CacheInvalidationConfigMetaData parent,
+ UnmarshallingContext navigator, String namespaceURI, String localName,
+ String value)
+ {
+ if(localName.equals("invalidation-group-name"))
+ {
+ parent.setInvalidationGroupName(value);
+ }
+ else if(localName.equals("invalidation-manager-name"))
+ {
+ parent.setInvalidationManagerName(value);
+ }
+ }
+
+ public void setValue(EjbPortComponentMetaData parent,
+ UnmarshallingContext navigator, String namespaceURI, String localName,
+ String value)
+ {
+ if(localName.equals("port-component-name"))
+ {
+ parent.setPortComponentName(value);
+ }
+ else if(localName.equals("port-component-uri"))
+ {
+ parent.setPortComponentURI(value);
+ }
+ else if(localName.equals("auth-method"))
+ {
+ parent.setAuthMethod(value);
+ }
+ else if(localName.equals("transport-guarantee"))
+ {
+ parent.setTransportGuarantee(value);
+ }
+ else if(localName.equals("port-uri"))
+ {
+ new IllegalStateException("Deprecated element <port-uri>, use <port-component-uri> instead");
+ }
+ }
+
+ public void setValue(ActivationConfigPropertyMetaData parent,
+ UnmarshallingContext navigator, String namespaceURI, String localName,
+ String value)
+ {
+ if(localName.equals("activation-config-property-name"))
+ {
+ parent.setName(value);
+ }
+ else if(localName.equals("activation-config-property-value"))
+ {
+ parent.setValue(value);
+ }
+ }
+
// static
public static class DomElement
@@ -528,4 +880,24 @@
e.setAttribute(attrs.getQName(i), attrs.getValue(i));
}
}
+
+ // inner
+
+ public static class InvokerMetaData
+ {
+ public static class EjbRef
+ {
+ String ejbRefName;
+ String jndiName;
+ }
+
+ BeanMetaData bean;
+ String bindingName;
+ String jndiName;
+
+ public InvokerMetaData(BeanMetaData bean)
+ {
+ this.bean = bean;
+ }
+ }
}
Modified: trunk/server/src/main/org/jboss/metadata/ActivationConfigPropertyMetaData.java
===================================================================
--- trunk/server/src/main/org/jboss/metadata/ActivationConfigPropertyMetaData.java 2006-11-09 12:16:30 UTC (rev 58230)
+++ trunk/server/src/main/org/jboss/metadata/ActivationConfigPropertyMetaData.java 2006-11-09 13:52:10 UTC (rev 58231)
@@ -92,6 +92,10 @@
public void setValue(String value)
{
+ if (Strings.isValidJavaIdentifier(name) == false)
+ {
+ throw new IllegalStateException("activation-config-property '" + name + "' is not a valid java identifier");
+ }
this.value = value;
}
Modified: trunk/server/src/main/org/jboss/metadata/BeanMetaData.java
===================================================================
--- trunk/server/src/main/org/jboss/metadata/BeanMetaData.java 2006-11-09 12:16:30 UTC (rev 58230)
+++ trunk/server/src/main/org/jboss/metadata/BeanMetaData.java 2006-11-09 13:52:10 UTC (rev 58231)
@@ -324,6 +324,15 @@
return (String)invokerBindings.get(invokerName);
}
+ public void addInvokerBinding(String bindingName, String jndiName)
+ {
+ if(invokerBindings == null)
+ {
+ invokerBindings = new HashMap();
+ }
+ invokerBindings.put(bindingName, jndiName);
+ }
+
public EjbRefMetaData getEjbRefByName(String name)
{
return (EjbRefMetaData)ejbReferences.get(name);
Modified: trunk/server/src/main/org/jboss/metadata/CacheInvalidationConfigMetaData.java
===================================================================
--- trunk/server/src/main/org/jboss/metadata/CacheInvalidationConfigMetaData.java 2006-11-09 12:16:30 UTC (rev 58230)
+++ trunk/server/src/main/org/jboss/metadata/CacheInvalidationConfigMetaData.java 2006-11-09 13:52:10 UTC (rev 58231)
@@ -49,7 +49,7 @@
// Attributes ----------------------------------------------------
protected String invalidationGroupName = null;
- protected String cacheInvaliderObjectName = null;
+ protected String invalidationManagerName = null;
// Static --------------------------------------------------------
@@ -66,22 +66,32 @@
public String getInvalidationManagerName ()
{
- return this.cacheInvaliderObjectName;
+ return this.invalidationManagerName;
}
-
+
+ public void setInvalidationGroupName(String invalidationGroupName)
+ {
+ this.invalidationGroupName = invalidationGroupName;
+ }
+
+ public void setInvalidationManagerName(String managerName)
+ {
+ this.invalidationManagerName = managerName;
+ }
+
public void init(BeanMetaData data)
{
// by default we use the bean name as the group name
//
this.invalidationGroupName = data.getEjbName ();
- this.cacheInvaliderObjectName = InvalidationManager.DEFAULT_JMX_SERVICE_NAME;
+ this.invalidationManagerName = InvalidationManager.DEFAULT_JMX_SERVICE_NAME;
}
public void importJbossXml(Element element) throws DeploymentException
{
this.invalidationGroupName = getElementContent(getOptionalChild(element, "invalidation-group-name"), this.invalidationGroupName);
- this.cacheInvaliderObjectName = getElementContent(getOptionalChild(element, "invalidation-manager-name"), this.cacheInvaliderObjectName);
+ this.invalidationManagerName = getElementContent(getOptionalChild(element, "invalidation-manager-name"), this.invalidationManagerName);
}
// Z implementation ----------------------------------------------
Modified: trunk/server/src/main/org/jboss/metadata/EjbPortComponentMetaData.java
===================================================================
--- trunk/server/src/main/org/jboss/metadata/EjbPortComponentMetaData.java 2006-11-09 12:16:30 UTC (rev 58230)
+++ trunk/server/src/main/org/jboss/metadata/EjbPortComponentMetaData.java 2006-11-09 13:52:10 UTC (rev 58231)
@@ -45,6 +45,7 @@
public EjbPortComponentMetaData(SessionMetaData sessionMetaData)
{
this.sessionMetaData = sessionMetaData;
+ portComponentURI = "/" + sessionMetaData.getEjbName();
}
public String getPortComponentName()
@@ -77,6 +78,56 @@
return transportGuarantee;
}
+ public void setPortComponentName(String portComponentName)
+ {
+ this.portComponentName = portComponentName;
+ }
+
+ public void setPortComponentURI(String portComponentURI)
+ {
+ ApplicationMetaData appMetaData = sessionMetaData.getApplicationMetaData();
+ String contextRoot = appMetaData.getWebServiceContextRoot();
+
+ if(portComponentURI.charAt(0) != '/')
+ {
+ portComponentURI = "/" + portComponentURI;
+ }
+
+ if(contextRoot == null)
+ {
+ // The first token is the webservice context root
+ StringTokenizer st = new StringTokenizer(portComponentURI, "/");
+ if(st.countTokens() < 2)
+ {
+ throw new IllegalStateException("Expected at least two tokens <port-component-uri>");
+ }
+
+ contextRoot = "/" + st.nextToken();
+ String prevContextRoot = contextRoot;
+ if(prevContextRoot != null && prevContextRoot.equals(contextRoot) == false)
+ {
+ throw new IllegalStateException("Invalid <port-component-uri>, expected to start with: " + prevContextRoot);
+ }
+
+ appMetaData.setWebServiceContextRoot(contextRoot);
+ portComponentURI = portComponentURI.substring(portComponentURI.indexOf('/', 1));
+ }
+ else if(portComponentURI.startsWith(contextRoot))
+ {
+ portComponentURI = portComponentURI.substring(contextRoot.length());
+ }
+ }
+
+ public void setAuthMethod(String authMethod)
+ {
+ this.authMethod = authMethod;
+ }
+
+ public void setTransportGuarantee(String transportGuarantee)
+ {
+ this.transportGuarantee = transportGuarantee;
+ }
+
public void importStandardXml(Element element)
throws DeploymentException
{
@@ -88,45 +139,21 @@
*/
public void importJBossXml(Element element) throws DeploymentException
{
- ApplicationMetaData appMetaData = sessionMetaData.getApplicationMetaData();
- String contextRoot = appMetaData.getWebServiceContextRoot();
-
// port-component/port-component-name
portComponentName = MetaData.getUniqueChildContent(element, "port-component-name");
// port-component/port-component-uri?
portComponentURI = MetaData.getOptionalChildContent(element, "port-component-uri");
- if (portComponentURI != null)
+ if(portComponentURI != null)
{
- if (portComponentURI.charAt(0) != '/')
- portComponentURI = "/" + portComponentURI;
-
- if (contextRoot == null)
- {
- // The first token is the webservice context root
- StringTokenizer st = new StringTokenizer(portComponentURI, "/");
- if (st.countTokens() < 2)
- throw new DeploymentException("Expected at least two tokens <port-component-uri>");
-
- contextRoot = "/" + st.nextToken();
- String prevContextRoot = contextRoot;
- if (prevContextRoot != null && prevContextRoot.equals(contextRoot) == false)
- throw new DeploymentException("Invalid <port-component-uri>, expected to start with: " + prevContextRoot);
-
- appMetaData.setWebServiceContextRoot(contextRoot);
- portComponentURI = portComponentURI.substring(portComponentURI.indexOf('/', 1));
- }
- else if (portComponentURI.startsWith(contextRoot))
- {
- portComponentURI = portComponentURI.substring(contextRoot.length());
- }
+ setPortComponentURI(portComponentURI);
}
else
{
portComponentURI = "/" + sessionMetaData.getEjbName();
// The context root will be derived from deployment short name
}
-
+
// port-component/auth-method?,
authMethod = MetaData.getOptionalChildContent(element, "auth-method");
// port-component/transport-guarantee?
Modified: trunk/server/src/main/org/jboss/metadata/EjbRefMetaData.java
===================================================================
--- trunk/server/src/main/org/jboss/metadata/EjbRefMetaData.java 2006-11-09 12:16:30 UTC (rev 58230)
+++ trunk/server/src/main/org/jboss/metadata/EjbRefMetaData.java 2006-11-09 13:52:10 UTC (rev 58231)
@@ -145,6 +145,11 @@
return (String) invokerMap.get(bindingName);
}
+ public void addInvokerBinding(String bindingName, String jndiName)
+ {
+ invokerMap.put(bindingName, jndiName);
+ }
+
public void importEjbJarXml(Element element) throws DeploymentException {
name = getElementContent(getUniqueChild(element, "ejb-ref-name"));
type = getElementContent(getUniqueChild(element, "ejb-ref-type"));
Modified: trunk/server/src/main/org/jboss/metadata/IorSecurityConfigMetaData.java
===================================================================
--- trunk/server/src/main/org/jboss/metadata/IorSecurityConfigMetaData.java 2006-11-09 12:16:30 UTC (rev 58230)
+++ trunk/server/src/main/org/jboss/metadata/IorSecurityConfigMetaData.java 2006-11-09 13:52:10 UTC (rev 58231)
@@ -136,7 +136,7 @@
/**
* The root element for security between the end points
*/
- public class TransportConfig
+ public static class TransportConfig
{
public static final String INTEGRITY_NONE = "NONE";
public static final String INTEGRITY_SUPPORTED = "SUPPORTED";
@@ -166,44 +166,44 @@
* The valid values are NONE, SUPPORTED or REQUIRED.
* Required element.
*/
- private final String integrity;
+ private String integrity;
/**
* confidentiality element indicates if the server (target) supports privacy protected
* messages. The values are NONE, SUPPORTED or REQUIRED.
* Required element.
*/
- private final String confidentiality;
+ private String confidentiality;
/**
* detect-misordering indicates if the server (target) supports detection
* of message sequence errors. The values are NONE, SUPPORTED or REQUIRED.
* Optional element.
*/
- private final String detectMisordering;
+ private String detectMisordering;
/**
* detect-replay indicates if the server (target) supports detection
* of message replay attempts. The values are NONE, SUPPORTED or REQUIRED.
* Optional element.
*/
- private final String detectReplay;
+ private String detectReplay;
/**
* establish-trust-in-target element indicates if the target is capable of authenticating to a client.
* The values are NONE or SUPPORTED.
* Required element.
*/
- private final String establishTrustInTarget;
+ private String establishTrustInTarget;
/**
* establish-trust-in-client element indicates if the target is capable of authenticating a client. The
* values are NONE, SUPPORTED or REQUIRED.
* Required element.
*/
- private final String establishTrustInClient;
+ private String establishTrustInClient;
- private TransportConfig()
+ public TransportConfig()
{
integrity = INTEGRITY_SUPPORTED;
confidentiality = CONFIDENTIALITY_SUPPORTED;
@@ -219,62 +219,66 @@
private TransportConfig(Element element) throws DeploymentException
{
String value = MetaData.getUniqueChildContent(element, "integrity");
- if(INTEGRITY_NONE.equalsIgnoreCase(value))
+ setIntegrity(value);
+
+ value = MetaData.getUniqueChildContent(element, "confidentiality");
+ setConfidentiality(value);
+
+ value = MetaData.getUniqueChildContent(element, "establish-trust-in-target");
+ setEstablishTrustInTarget(value);
+
+ value = MetaData.getUniqueChildContent(element, "establish-trust-in-client");
+ setEstablishTrustInClient(value);
+
+ value = MetaData.getOptionalChildContent(element, "detect-misordering");
+ setDetectMisordering(value);
+
+ value = MetaData.getOptionalChildContent(element, "detect-replay");
+ setDetectReplay(value);
+ }
+
+ public void setDetectReplay(String value)
+ {
+ if( DETECT_REPLAY_NONE.equalsIgnoreCase(value) )
{
- integrity = INTEGRITY_NONE;
+ this.detectReplay = DETECT_REPLAY_NONE;
}
- else if(INTEGRITY_SUPPORTED.equalsIgnoreCase(value))
+ else if( DETECT_REPLAY_REQUIRED.equalsIgnoreCase(value) )
{
- integrity = INTEGRITY_SUPPORTED;
+ this.detectReplay = DETECT_REPLAY_REQUIRED;
}
- else if(INTEGRITY_REQUIRED.equalsIgnoreCase(value))
+ else if( DETECT_REPLAY_SUPPORTED.equalsIgnoreCase(value) )
{
- integrity = INTEGRITY_REQUIRED;
+ this.detectReplay = DETECT_REPLAY_SUPPORTED;
}
else
{
- throw new DeploymentException("Allowed values for integrity element are " +
- INTEGRITY_NONE + ", " + INTEGRITY_REQUIRED + " and " + INTEGRITY_SUPPORTED +
- " but got " + value);
+ this.detectReplay = DETECT_REPLAY_NONE;
}
+ }
- value = MetaData.getUniqueChildContent(element, "confidentiality");
- if(CONFIDENTIALITY_NONE.equalsIgnoreCase(value))
+ public void setDetectMisordering(String value)
+ {
+ if( DETECT_MISORDERING_NONE.equalsIgnoreCase(value) )
{
- confidentiality = CONFIDENTIALITY_NONE;
+ this.detectMisordering = DETECT_MISORDERING_NONE;
}
- else if(CONFIDENTIALITY_SUPPORTED.equalsIgnoreCase(value))
+ else if( DETECT_MISORDERING_REQUIRED.equalsIgnoreCase(value) )
{
- confidentiality = CONFIDENTIALITY_SUPPORTED;
+ this.detectMisordering = DETECT_MISORDERING_REQUIRED;
}
- else if(CONFIDENTIALITY_REQUIRED.equalsIgnoreCase(value))
+ else if( DETECT_MISORDERING_SUPPORTED.equalsIgnoreCase(value) )
{
- confidentiality = CONFIDENTIALITY_REQUIRED;
+ this.detectMisordering = DETECT_MISORDERING_SUPPORTED;
}
else
{
- throw new DeploymentException("Allowed values for confidentiality are " +
- CONFIDENTIALITY_NONE + ", " + CONFIDENTIALITY_SUPPORTED + " and " + CONFIDENTIALITY_REQUIRED +
- " but got " + value);
+ this.detectMisordering = DETECT_MISORDERING_NONE;
}
+ }
- value = MetaData.getUniqueChildContent(element, "establish-trust-in-target");
- if(ESTABLISH_TRUST_IN_TARGET_NONE.equalsIgnoreCase(value))
- {
- establishTrustInTarget = ESTABLISH_TRUST_IN_TARGET_NONE;
- }
- else if(ESTABLISH_TRUST_IN_TARGET_SUPPORTED.equalsIgnoreCase(value))
- {
- establishTrustInTarget = ESTABLISH_TRUST_IN_TARGET_SUPPORTED;
- }
- else
- {
- throw new DeploymentException("Allowed values for establish-trust-in-target are " +
- ESTABLISH_TRUST_IN_TARGET_NONE + " and " + ESTABLISH_TRUST_IN_TARGET_SUPPORTED +
- " but got " + value);
- }
-
- value = MetaData.getUniqueChildContent(element, "establish-trust-in-client");
+ public void setEstablishTrustInClient(String value)
+ {
if(ESTABLISH_TRUST_IN_CLIENT_NONE.equalsIgnoreCase(value))
{
establishTrustInClient = ESTABLISH_TRUST_IN_CLIENT_NONE;
@@ -289,45 +293,71 @@
}
else
{
- throw new DeploymentException("Allowed values for establish-trust-in-client are " +
+ throw new IllegalStateException("Allowed values for establish-trust-in-client are " +
ESTABLISH_TRUST_IN_CLIENT_NONE + ", " + ESTABLISH_TRUST_IN_CLIENT_SUPPORTED + " and " +
ESTABLISH_TRUST_IN_CLIENT_REQUIRED + " but got " + value);
}
+ }
- value = MetaData.getOptionalChildContent(element, "detect-misordering");
- if( DETECT_MISORDERING_NONE.equalsIgnoreCase(value) )
+ public void setEstablishTrustInTarget(String value)
+ {
+ if(ESTABLISH_TRUST_IN_TARGET_NONE.equalsIgnoreCase(value))
{
- this.detectMisordering = DETECT_MISORDERING_NONE;
+ establishTrustInTarget = ESTABLISH_TRUST_IN_TARGET_NONE;
}
- else if( DETECT_MISORDERING_REQUIRED.equalsIgnoreCase(value) )
+ else if(ESTABLISH_TRUST_IN_TARGET_SUPPORTED.equalsIgnoreCase(value))
{
- this.detectMisordering = DETECT_MISORDERING_REQUIRED;
+ establishTrustInTarget = ESTABLISH_TRUST_IN_TARGET_SUPPORTED;
}
- else if( DETECT_MISORDERING_SUPPORTED.equalsIgnoreCase(value) )
+ else
{
- this.detectMisordering = DETECT_MISORDERING_SUPPORTED;
+ throw new IllegalStateException("Allowed values for establish-trust-in-target are " +
+ ESTABLISH_TRUST_IN_TARGET_NONE + " and " + ESTABLISH_TRUST_IN_TARGET_SUPPORTED +
+ " but got " + value);
}
+ }
+
+ public void setConfidentiality(String value)
+ {
+ if(CONFIDENTIALITY_NONE.equalsIgnoreCase(value))
+ {
+ confidentiality = CONFIDENTIALITY_NONE;
+ }
+ else if(CONFIDENTIALITY_SUPPORTED.equalsIgnoreCase(value))
+ {
+ confidentiality = CONFIDENTIALITY_SUPPORTED;
+ }
+ else if(CONFIDENTIALITY_REQUIRED.equalsIgnoreCase(value))
+ {
+ confidentiality = CONFIDENTIALITY_REQUIRED;
+ }
else
{
- this.detectMisordering = DETECT_MISORDERING_NONE;
+ throw new IllegalStateException("Allowed values for confidentiality are " +
+ CONFIDENTIALITY_NONE + ", " + CONFIDENTIALITY_SUPPORTED + " and " + CONFIDENTIALITY_REQUIRED +
+ " but got " + value);
}
+ }
- value = MetaData.getOptionalChildContent(element, "detect-replay");
- if( DETECT_REPLAY_NONE.equalsIgnoreCase(value) )
+ public void setIntegrity(String value)
+ {
+ if(INTEGRITY_NONE.equalsIgnoreCase(value))
{
- this.detectReplay = DETECT_REPLAY_NONE;
+ integrity = INTEGRITY_NONE;
}
- else if( DETECT_REPLAY_REQUIRED.equalsIgnoreCase(value) )
+ else if(INTEGRITY_SUPPORTED.equalsIgnoreCase(value))
{
- this.detectReplay = DETECT_REPLAY_REQUIRED;
+ integrity = INTEGRITY_SUPPORTED;
}
- else if( DETECT_REPLAY_SUPPORTED.equalsIgnoreCase(value) )
+ else if(INTEGRITY_REQUIRED.equalsIgnoreCase(value))
{
- this.detectReplay = DETECT_REPLAY_SUPPORTED;
+ integrity = INTEGRITY_REQUIRED;
}
else
{
- this.detectReplay = DETECT_REPLAY_NONE;
+ throw new IllegalStateException("Allowed values for integrity element are " +
+ INTEGRITY_NONE + ", " + INTEGRITY_REQUIRED + " and " + INTEGRITY_SUPPORTED +
+ " but got " + value);
}
}
@@ -382,7 +412,7 @@
* mechanism that will be used to authenticate the client. It can be either
* the username-password mechanism, or none (default).
*/
- public class AsContext
+ public static class AsContext
{
public static final String AUTH_METHOD_USERNAME_PASSWORD = "USERNAME_PASSWORD";
public static final String AUTH_METHOD_NONE = "NONE";
@@ -392,14 +422,14 @@
* are USERNAME_PASSWORD and NONE.
* Required element.
*/
- private final String authMethod;
+ private String authMethod;
/**
* realm element describes the realm in which the user is authenticated. Must be
* a valid realm that is registered in server configuration.
* Required element.
*/
- private final String realm;
+ private String realm;
/**
* required element specifies if the authentication method specified is required
@@ -408,9 +438,9 @@
* is either true or false.
* Required element.
*/
- private final boolean required;
+ private boolean required;
- private AsContext()
+ public AsContext()
{
authMethod = AUTH_METHOD_USERNAME_PASSWORD;
realm = "default";
@@ -420,20 +450,7 @@
private AsContext(Element element) throws DeploymentException
{
String value = MetaData.getUniqueChildContent(element, "auth-method");
- if(AUTH_METHOD_USERNAME_PASSWORD.equalsIgnoreCase(value))
- {
- authMethod = AUTH_METHOD_USERNAME_PASSWORD;
- }
- else if (AUTH_METHOD_NONE.equalsIgnoreCase(value))
- {
- authMethod = AUTH_METHOD_NONE;
- }
- else
- {
- throw new DeploymentException("The only allowed values for auth-method are "
- + AUTH_METHOD_USERNAME_PASSWORD + ", " + AUTH_METHOD_NONE +
- " but got " + value);
- }
+ setAuthMethod(value);
realm = MetaData.getUniqueChildContent(element, "realm");
if(realm == null || realm.trim().length() == 0)
@@ -457,6 +474,24 @@
}
}
+ public void setAuthMethod(String value)
+ {
+ if(AUTH_METHOD_USERNAME_PASSWORD.equalsIgnoreCase(value))
+ {
+ authMethod = AUTH_METHOD_USERNAME_PASSWORD;
+ }
+ else if (AUTH_METHOD_NONE.equalsIgnoreCase(value))
+ {
+ authMethod = AUTH_METHOD_NONE;
+ }
+ else
+ {
+ throw new IllegalStateException("The only allowed values for auth-method are "
+ + AUTH_METHOD_USERNAME_PASSWORD + ", " + AUTH_METHOD_NONE +
+ " but got " + value);
+ }
+ }
+
public String getAuthMethod()
{
return authMethod;
@@ -472,6 +507,16 @@
return required;
}
+ public void setRealm(String realm)
+ {
+ this.realm = realm;
+ }
+
+ public void setRequired(boolean required)
+ {
+ this.required = required;
+ }
+
public String toString()
{
return
@@ -485,7 +530,7 @@
* sas-context (related to CSIv2 security attribute service) element describes
* the sas-context fields.
*/
- public class SasContext
+ public static class SasContext
{
public static final String CALLER_PROPAGATION_NONE = "NONE";
public static final String CALLER_PROPAGATION_SUPPORTED = "SUPPORTED";
@@ -495,15 +540,21 @@
* The values are NONE or SUPPORTED.
* Required element.
*/
- private final String callerPropagation;
+ private String callerPropagation;
- private SasContext()
+ public SasContext()
{
callerPropagation = CALLER_PROPAGATION_NONE;
}
+
private SasContext(Element element) throws DeploymentException
{
String value = MetaData.getUniqueChildContent(element, "caller-propagation");
+ setCallerPropagation(value);
+ }
+
+ public void setCallerPropagation(String value)
+ {
if(CALLER_PROPAGATION_NONE.equalsIgnoreCase(value))
{
callerPropagation = CALLER_PROPAGATION_NONE;
@@ -514,7 +565,7 @@
}
else
{
- throw new DeploymentException("Allowed values for caller-propagation are " +
+ throw new IllegalStateException("Allowed values for caller-propagation are " +
CALLER_PROPAGATION_NONE + " and " + CALLER_PROPAGATION_SUPPORTED + " but got " + value);
}
}
Modified: trunk/server/src/main/org/jboss/metadata/MethodAttributes.java
===================================================================
--- trunk/server/src/main/org/jboss/metadata/MethodAttributes.java 2006-11-09 12:16:30 UTC (rev 58230)
+++ trunk/server/src/main/org/jboss/metadata/MethodAttributes.java 2006-11-09 13:52:10 UTC (rev 58231)
@@ -61,6 +61,26 @@
kDefaultMethodAttributes.txTimeout = 0;
}
+ public void setPattern(String pattern)
+ {
+ this.pattern = pattern;
+ }
+
+ public void setReadOnly(boolean readOnly)
+ {
+ this.readOnly = readOnly;
+ }
+
+ public void setIdempotent(boolean idempotent)
+ {
+ this.idempotent = idempotent;
+ }
+
+ public void setTxTimeout(int txTimeout)
+ {
+ this.txTimeout = txTimeout;
+ }
+
public boolean patternMatches(String methodName)
{
int ct, end;
More information about the jboss-cvs-commits
mailing list