You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@synapse.apache.org by in...@apache.org on 2008/06/24 10:10:29 UTC
svn commit: r671056 - in
/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/registry:
AbstractRegistry.java Registry.java RegistryEntry.java
RegistryEntryImpl.java url/SimpleURLRegistry.java
Author: indika
Date: Tue Jun 24 01:10:28 2008
New Revision: 671056
URL: http://svn.apache.org/viewvc?rev=671056&view=rev
Log:
fix for synape 371
Modified:
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/registry/AbstractRegistry.java
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/registry/Registry.java
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/registry/RegistryEntry.java
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/registry/RegistryEntryImpl.java
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/registry/url/SimpleURLRegistry.java
Modified: synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/registry/AbstractRegistry.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/registry/AbstractRegistry.java?rev=671056&r1=671055&r2=671056&view=diff
==============================================================================
--- synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/registry/AbstractRegistry.java (original)
+++ synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/registry/AbstractRegistry.java Tue Jun 24 01:10:28 2008
@@ -27,9 +27,6 @@
import org.apache.synapse.endpoints.Endpoint;
import org.apache.synapse.mediators.base.SequenceMediator;
-import java.net.URI;
-import java.util.HashMap;
-import java.util.Map;
import java.util.Properties;
/**
@@ -148,7 +145,7 @@
return entry.getValue();
}
- private XMLToObjectMapper getMapper(URI type) {
+ private XMLToObjectMapper getMapper(String type) {
return null;
}
Modified: synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/registry/Registry.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/registry/Registry.java?rev=671056&r1=671055&r2=671056&view=diff
==============================================================================
--- synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/registry/Registry.java (original)
+++ synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/registry/Registry.java Tue Jun 24 01:10:28 2008
@@ -22,7 +22,6 @@
import org.apache.axiom.om.OMNode;
import org.apache.synapse.config.Entry;
-import java.util.Map;
import java.util.Properties;
/**
Modified: synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/registry/RegistryEntry.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/registry/RegistryEntry.java?rev=671056&r1=671055&r2=671056&view=diff
==============================================================================
--- synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/registry/RegistryEntry.java (original)
+++ synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/registry/RegistryEntry.java Tue Jun 24 01:10:28 2008
@@ -19,8 +19,6 @@
package org.apache.synapse.registry;
-import java.net.URI;
-
/**
* This interface defines the core information to be returned by a Registry implementation
* about a resource being managed by it. Every Registry implementation *must* provide valid
@@ -38,7 +36,7 @@
public long getVersion();
/** The type of the resource - optional */
- public URI getType();
+ public String getType();
/** A description for the resource - optional */
public String getDescription();
Modified: synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/registry/RegistryEntryImpl.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/registry/RegistryEntryImpl.java?rev=671056&r1=671055&r2=671056&view=diff
==============================================================================
--- synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/registry/RegistryEntryImpl.java (original)
+++ synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/registry/RegistryEntryImpl.java Tue Jun 24 01:10:28 2008
@@ -19,17 +19,22 @@
package org.apache.synapse.registry;
-import org.apache.synapse.registry.RegistryEntry;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.synapse.SynapseException;
-import java.net.URI;
+import javax.mail.internet.ContentType;
+import javax.mail.internet.ParseException;
import java.util.Date;
public class RegistryEntryImpl implements RegistryEntry {
+ private static final Log log = LogFactory.getLog(RegistryEntry.class);
+
private String key = null;
private String name = null;
private long version = Long.MIN_VALUE;
- private URI type = null;
+ private String type = null;
private String description;
private long created;
private long lastModified;
@@ -59,12 +64,21 @@
this.version = version;
}
- public URI getType() {
+ public String getType() {
return type;
}
- public void setType(URI type) {
- this.type = type;
+ public void setType(String type) {
+ try {
+ new ContentType(type);
+ if (log.isDebugEnabled()) {
+ log.debug("Content type :" + type);
+ }
+ this.type = type;
+ } catch (ParseException e) {
+ String msg = "Invalid content-type ' " + type + " '";
+ throw new SynapseException(msg, e);
+ }
}
public String getDescription() {
Modified: synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/registry/url/SimpleURLRegistry.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/registry/url/SimpleURLRegistry.java?rev=671056&r1=671055&r2=671056&view=diff
==============================================================================
--- synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/registry/url/SimpleURLRegistry.java (original)
+++ synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/registry/url/SimpleURLRegistry.java Tue Jun 24 01:10:28 2008
@@ -19,8 +19,8 @@
package org.apache.synapse.registry.url;
-import org.apache.axiom.om.OMNode;
import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.OMNode;
import org.apache.axiom.om.impl.builder.StAXOMBuilder;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -35,7 +35,9 @@
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import java.io.*;
-import java.net.*;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLConnection;
import java.util.ArrayList;
import java.util.Properties;
@@ -139,7 +141,7 @@
RegistryEntryImpl wre = new RegistryEntryImpl();
wre.setKey(key);
wre.setName(url.getFile());
- wre.setType(new URI(urlc.getContentType()));
+ wre.setType(urlc.getContentType());
wre.setDescription("Resource at : " + url.toString());
wre.setLastModified(urlc.getLastModified());
wre.setVersion(urlc.getLastModified());
@@ -155,8 +157,6 @@
handleException("Invalid URL reference " + root + key, e);
} catch (IOException e) {
handleException("IO Error reading from URL " + root + key, e);
- } catch (URISyntaxException e) {
- handleException("URI Syntax error reading from URL " + root + key, e);
}
return null;
}
@@ -165,15 +165,12 @@
super.init(properties);
String value = properties.getProperty("root");
if (value != null) {
-
// if the root is folder, it should always end with '/'
// therefore, property keys do not have to begin with '/', which could be misleading
try {
- URL url = new URL(value);
- if (url.getProtocol().equals("file")) {
- if (!value.endsWith("/")) {
- value = value + "/";
- }
+ new URL(value);
+ if (!value.endsWith("/")) {
+ value = value + "/";
}
} catch (MalformedURLException e) {
// don't do any thing if this is not a valid URL