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 2007/05/24 00:54:19 UTC
svn commit: r541113 - in /geronimo/server/trunk/modules:
geronimo-connector-builder/src/main/java/org/apache/geronimo/connector/deployment/ResourceRefBuilder.java
geronimo-naming/src/main/java/org/apache/geronimo/naming/reference/URLReference.java
Author: djencks
Date: Wed May 23 15:54:18 2007
New Revision: 541113
URL: http://svn.apache.org/viewvc?view=rev&rev=541113
Log:
GERONIMO-3175 URLReference so url lookups return a new instance each time
Added:
geronimo/server/trunk/modules/geronimo-naming/src/main/java/org/apache/geronimo/naming/reference/URLReference.java (with props)
Modified:
geronimo/server/trunk/modules/geronimo-connector-builder/src/main/java/org/apache/geronimo/connector/deployment/ResourceRefBuilder.java
Modified: geronimo/server/trunk/modules/geronimo-connector-builder/src/main/java/org/apache/geronimo/connector/deployment/ResourceRefBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-connector-builder/src/main/java/org/apache/geronimo/connector/deployment/ResourceRefBuilder.java?view=diff&rev=541113&r1=541112&r2=541113
==============================================================================
--- geronimo/server/trunk/modules/geronimo-connector-builder/src/main/java/org/apache/geronimo/connector/deployment/ResourceRefBuilder.java (original)
+++ geronimo/server/trunk/modules/geronimo-connector-builder/src/main/java/org/apache/geronimo/connector/deployment/ResourceRefBuilder.java Wed May 23 15:54:18 2007
@@ -55,6 +55,7 @@
import org.apache.geronimo.naming.deployment.ResourceEnvironmentSetter;
import org.apache.geronimo.naming.reference.ORBReference;
import org.apache.geronimo.naming.reference.ResourceReference;
+import org.apache.geronimo.naming.reference.URLReference;
import org.apache.geronimo.xbeans.geronimo.naming.GerPatternType;
import org.apache.geronimo.xbeans.geronimo.naming.GerResourceRefDocument;
import org.apache.geronimo.xbeans.geronimo.naming.GerResourceRefType;
@@ -132,12 +133,16 @@
if (gerResourceRef == null || !gerResourceRef.isSetUrl()) {
throw new DeploymentException("No url supplied to resolve: " + name);
}
+ String url = gerResourceRef.getUrl().trim();
+ //TODO expose jsr-77 objects for these guys
try {
- //TODO expose jsr-77 objects for these guys
- getJndiContextMap(componentContext).put(ENV + name, new URL(gerResourceRef.getUrl()));
+ //check for malformed URL
+ new URL(url);
} catch (MalformedURLException e) {
- throw new DeploymentException("Could not convert " + gerResourceRef.getUrl() + " to URL", e);
+ throw new DeploymentException("Could not convert " + url + " to URL", e);
}
+ getJndiContextMap(componentContext).put(ENV + name, new URLReference(url));
+
} else if (ORB.class.isAssignableFrom(iface)) {
CorbaGBeanNameSource corbaGBeanNameSource = (CorbaGBeanNameSource) corbaGBeanNameSourceCollection.getElement();
if (corbaGBeanNameSource == null) {
Added: geronimo/server/trunk/modules/geronimo-naming/src/main/java/org/apache/geronimo/naming/reference/URLReference.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-naming/src/main/java/org/apache/geronimo/naming/reference/URLReference.java?view=auto&rev=541113
==============================================================================
--- geronimo/server/trunk/modules/geronimo-naming/src/main/java/org/apache/geronimo/naming/reference/URLReference.java (added)
+++ geronimo/server/trunk/modules/geronimo-naming/src/main/java/org/apache/geronimo/naming/reference/URLReference.java Wed May 23 15:54:18 2007
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.reference;
+
+import java.net.URL;
+import java.net.MalformedURLException;
+
+import javax.naming.NamingException;
+
+/**
+ * @version $Rev:$ $Date:$
+ */
+public class URLReference extends SimpleReference {
+
+ private final String url;
+
+
+ public URLReference(String url) {
+ this.url = url;
+ }
+
+ public Object getContent() throws NamingException {
+ try {
+ return new URL(url);
+ } catch (MalformedURLException e) {
+ throw (NamingException)new NamingException("Could not construct desired URL: " + url).initCause(e);
+ }
+ }
+
+ public String getClassName() {
+ return "java.net.URL";
+ }
+
+}
Propchange: geronimo/server/trunk/modules/geronimo-naming/src/main/java/org/apache/geronimo/naming/reference/URLReference.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/modules/geronimo-naming/src/main/java/org/apache/geronimo/naming/reference/URLReference.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/modules/geronimo-naming/src/main/java/org/apache/geronimo/naming/reference/URLReference.java
------------------------------------------------------------------------------
svn:mime-type = text/plain