Author: djencks
Date: Wed Jun 1 19:50:40 2005
New Revision: 179491
URL: http://svn.apache.org/viewcvs?rev=179491&view=rev
Log:
GERONIMO-658. Make css bean references nice and short like other gbean references, with most
parts defaulted
Modified:
geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/RefContext.java
geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/j2eeobjectnames/NameFactory.java
geronimo/trunk/modules/naming-builder/src/java/org/apache/geronimo/naming/deployment/ENCConfigBuilder.java
geronimo/trunk/modules/naming-builder/src/java/org/apache/geronimo/naming/deployment/GBeanResourceEnvironmentBuilder.java
geronimo/trunk/modules/naming-builder/src/java/org/apache/geronimo/naming/deployment/ResourceEnvironmentBuilder.java
geronimo/trunk/modules/naming-builder/src/schema/geronimo-naming.xsd
Modified: geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/RefContext.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/RefContext.java?rev=179491&r1=179490&r2=179491&view=diff
==============================================================================
--- geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/RefContext.java
(original)
+++ geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/RefContext.java
Wed Jun 1 19:50:40 2005
@@ -267,30 +267,35 @@
try {
return getContainerId(module, resourceLink, (Map) connectionFactoryIndex.get(name));
} catch (UnknownEJBRefException e) {
-
- ObjectName query = null;
- try {
- query = NameFactory.getComponentNameQuery(null, null, null, name, type, j2eeContext);
- } catch (MalformedObjectNameException e1) {
- throw new DeploymentException("Could not construct connection factory object
name query", e);
- }
- Set matches = context.listGBeans(query);
- if (matches.size() > 1) {
- throw new DeploymentException("More than one match for query " + matches);
- }
- if (matches.size() == 1) {
- return ((ObjectName) matches.iterator().next()).getCanonicalName();
- }
- try {
- query = NameFactory.getComponentRestrictedQueryName(null, null, name, type,
j2eeContext);
- } catch (MalformedObjectNameException e1) {
- throw new DeploymentException("Could not construct connection factory object
name query", e);
- }
- ObjectName containerName = locateUniqueName(query, "resource");
+ ObjectName containerName = locateComponent(name, type, j2eeContext, context,
"connection factory");
return containerName.getCanonicalName();
}
}
+ public ObjectName locateComponent(String name, String type, J2eeContext j2eeContext,
DeploymentContext context, String queryType) throws DeploymentException {
+ ObjectName query = null;
+ ObjectName containerName;
+ try {
+ query = NameFactory.getComponentNameQuery(null, null, null, name, type, j2eeContext);
+ } catch (MalformedObjectNameException e1) {
+ throw new DeploymentException("Could not construct " + queryType + " object name
query", e1);
+ }
+ Set matches = context.listGBeans(query);
+ if (matches.size() > 1) {
+ throw new DeploymentException("More than one match for query " + matches);
+ }
+ if (matches.size() == 1) {
+ containerName = (ObjectName) matches.iterator().next();
+ }
+ try {
+ query = NameFactory.getComponentRestrictedQueryName(null, null, name, type, j2eeContext);
+ } catch (MalformedObjectNameException e1) {
+ throw new DeploymentException("Could not construct " + queryType + " object name
query", e1);
+ }
+ containerName = locateUniqueName(query, queryType);
+ return containerName;
+ }
+
public Reference getAdminObjectRef(String containerId, Class iface) throws DeploymentException
{
return resourceReferenceBuilder.createAdminObjectRef(containerId, iface);
}
@@ -310,7 +315,7 @@
return containerName.getCanonicalName();
}
}
-
+
public Object getServiceReference(Class serviceInterface, URI wsdlURI, URI jaxrpcMappingURI,
QName serviceQName, Map portComponentRefMap, List handlerInfos, Object serviceRefType, DeploymentContext
deploymentContext, Module module, ClassLoader classLoader) throws DeploymentException {
return serviceReferenceBuilder.createService(serviceInterface, wsdlURI, jaxrpcMappingURI,
serviceQName, portComponentRefMap, handlerInfos, serviceRefType, deploymentContext, module,
classLoader);
}
Modified: geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/j2eeobjectnames/NameFactory.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/j2eeobjectnames/NameFactory.java?rev=179491&r1=179490&r2=179491&view=diff
==============================================================================
--- geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/j2eeobjectnames/NameFactory.java
(original)
+++ geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/j2eeobjectnames/NameFactory.java
Wed Jun 1 19:50:40 2005
@@ -98,6 +98,8 @@
// public static final String URL_PATTERN = "URLPattern";
public static String DEFAULT_SERVLET = "DefaultServlet";
public static final String SERVLET_WEB_SERVICE_TEMPLATE = "ServletWebServiceTemplate";
+ public static final String CORBA_CSS = "CORBACSS";
+ public static final String CORBA_TSS = "CORBATSS";
public static ObjectName getDomainName(String j2eeDomainName, J2eeContext context) throws
MalformedObjectNameException {
Properties props = new Properties();
Modified: geronimo/trunk/modules/naming-builder/src/java/org/apache/geronimo/naming/deployment/ENCConfigBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/naming-builder/src/java/org/apache/geronimo/naming/deployment/ENCConfigBuilder.java?rev=179491&r1=179490&r2=179491&view=diff
==============================================================================
--- geronimo/trunk/modules/naming-builder/src/java/org/apache/geronimo/naming/deployment/ENCConfigBuilder.java
(original)
+++ geronimo/trunk/modules/naming-builder/src/java/org/apache/geronimo/naming/deployment/ENCConfigBuilder.java
Wed Jun 1 19:50:40 2005
@@ -52,6 +52,7 @@
import org.apache.geronimo.xbeans.geronimo.naming.GerResourceEnvRefType;
import org.apache.geronimo.xbeans.geronimo.naming.GerResourceRefType;
import org.apache.geronimo.xbeans.geronimo.naming.GerServiceRefType;
+import org.apache.geronimo.xbeans.geronimo.naming.GerCssType;
import org.apache.geronimo.xbeans.j2ee.EjbLocalRefType;
import org.apache.geronimo.xbeans.j2ee.EjbRefType;
import org.apache.geronimo.xbeans.j2ee.EnvEntryType;
@@ -86,6 +87,7 @@
if (context.listGBeans(exact).size() == 1) {
containerId = exact;
} else {
+ //TODO figure out some way to use the copy of this code in RefContext
ObjectName query = null;
try {
query = NameFactory.getComponentNameQuery(null, null, null, linkName,
j2eeType, j2eeContext);
@@ -345,9 +347,25 @@
ejbReference = refContext.getEJBRemoteRef(getStringValue(remoteRef.getTargetName()),
isSession, home, remote);
} else if (remoteRef.isSetNsCorbaloc()) {
try {
+ ObjectName cssBean;
+ if (remoteRef.isSetCssName()) {
+ cssBean = ObjectName.getInstance(getStringValue(remoteRef.getCssName()));
+ } else if (remoteRef.isSetCssLink()) {
+ String cssLink = remoteRef.getCssLink().trim();
+ cssBean = refContext.locateComponent(cssLink, NameFactory.CORBA_CSS,
j2eeContext, earContext, "css gbean");
+ } else {
+ GerCssType css = remoteRef.getCss();
+ cssBean = NameFactory.getComponentName(getStringValue(css.getDomain()),
+ getStringValue(css.getServer()),
+ getStringValue(css.getApplication()),
+ getStringValue(css.getModule()),
+ getStringValue(css.getName()),
+ getStringValue(NameFactory.CORBA_CSS),
+ j2eeContext);
+ }
ejbReference = refContext.getCORBARemoteRef(new URI(getStringValue(remoteRef.getNsCorbaloc())),
getStringValue(remoteRef.getName()),
- ObjectName.getInstance(getStringValue(remoteRef.getCssName())),
+ ObjectName.getInstance(cssBean),
home);
} catch (URISyntaxException e) {
throw new DeploymentException("Could not construct CORBA NameServer
URI: " + remoteRef.getNsCorbaloc(), e);
Modified: geronimo/trunk/modules/naming-builder/src/java/org/apache/geronimo/naming/deployment/GBeanResourceEnvironmentBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/naming-builder/src/java/org/apache/geronimo/naming/deployment/GBeanResourceEnvironmentBuilder.java?rev=179491&r1=179490&r2=179491&view=diff
==============================================================================
--- geronimo/trunk/modules/naming-builder/src/java/org/apache/geronimo/naming/deployment/GBeanResourceEnvironmentBuilder.java
(original)
+++ geronimo/trunk/modules/naming-builder/src/java/org/apache/geronimo/naming/deployment/GBeanResourceEnvironmentBuilder.java
Wed Jun 1 19:50:40 2005
@@ -1,3 +1,19 @@
+/**
+ *
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.apache.geronimo.naming.deployment;
import java.util.Set;
@@ -5,6 +21,7 @@
import org.apache.geronimo.gbean.GBeanData;
/**
+ * @version $Revision: 1.1 $ $Date: 2004/06/25 21:35:11 $
*/
public class GBeanResourceEnvironmentBuilder implements ResourceEnvironmentBuilder {
Modified: geronimo/trunk/modules/naming-builder/src/java/org/apache/geronimo/naming/deployment/ResourceEnvironmentBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/naming-builder/src/java/org/apache/geronimo/naming/deployment/ResourceEnvironmentBuilder.java?rev=179491&r1=179490&r2=179491&view=diff
==============================================================================
--- geronimo/trunk/modules/naming-builder/src/java/org/apache/geronimo/naming/deployment/ResourceEnvironmentBuilder.java
(original)
+++ geronimo/trunk/modules/naming-builder/src/java/org/apache/geronimo/naming/deployment/ResourceEnvironmentBuilder.java
Wed Jun 1 19:50:40 2005
@@ -1,10 +1,25 @@
+/**
+ *
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.apache.geronimo.naming.deployment;
import java.util.Set;
/**
- *
- *
* @version $Revision: 1.1 $ $Date: 2004/06/25 21:35:11 $
*
* */
Modified: geronimo/trunk/modules/naming-builder/src/schema/geronimo-naming.xsd
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/naming-builder/src/schema/geronimo-naming.xsd?rev=179491&r1=179490&r2=179491&view=diff
==============================================================================
--- geronimo/trunk/modules/naming-builder/src/schema/geronimo-naming.xsd (original)
+++ geronimo/trunk/modules/naming-builder/src/schema/geronimo-naming.xsd Wed Jun 1 19:50:40
2005
@@ -198,7 +198,7 @@
<xsd:element name="service-ref-name" type="xsd:string"/>
<xsd:choice>
<xsd:element name="service-completion" type="gernaming:service-completionType"/>
- <xsd:element name="port" type="gernaming:portType" maxOccurs="unbounded"/>
+ <xsd:element name="port" type="gernaming:portType" maxOccurs="unbounded"/>
</xsd:choice>
</xsd:sequence>
</xsd:complexType>
@@ -242,14 +242,25 @@
</xsd:documentation>
</xsd:annotation>
</xsd:element>
- <xsd:element name="css-name" type="xsd:string">
- <xsd:annotation>
- <xsd:documentation>
+ <xsd:choice>
+ <xsd:element name="css" type="gernaming:cssType"/>
+ <xsd:element name="css-link" type="xsd:string"/>
+ <xsd:element name="css-name" type="xsd:string">
+ <xsd:annotation>
+ <xsd:documentation>
The GBean name of the client security server used to make interop
calls.
- </xsd:documentation>
- </xsd:annotation>
- </xsd:element>
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ </xsd:choice>
</xsd:sequence>
</xsd:group>
+
+ <xsd:complexType name="cssType">
+ <xsd:sequence>
+ <!-- todo type is not relevant -->
+ <xsd:group ref="gernaming:objectNameGroup"/>
+ </xsd:sequence>
+ </xsd:complexType>
</xsd:schema>
|