Revision: 7768
Author: victormote
Date: 2006-07-07 19:38:24 -0700 (Fri, 07 Jul 2006)
ViewCVS: http://svn.sourceforge.net/foray/?rev=7768&view=rev
Log Message:
-----------
1. Rename variables and methods for clarity.
2. Minor doc changes.
Modified Paths:
--------------
trunk/foray/foray-common/src/java/org/foray/common/url/PropertyProtocolRegistration.java
trunk/foray/foray-common/src/java/org/foray/common/url/ProtocolRegistrationBroker.java
trunk/foray/foray-common/src/java/org/foray/common/url/classpath/Handler.java
Modified: trunk/foray/foray-common/src/java/org/foray/common/url/PropertyProtocolRegistration.java
===================================================================
--- trunk/foray/foray-common/src/java/org/foray/common/url/PropertyProtocolRegistration.java 2006-07-08 02:27:21 UTC (rev 7767)
+++ trunk/foray/foray-common/src/java/org/foray/common/url/PropertyProtocolRegistration.java 2006-07-08 02:38:24 UTC (rev 7768)
@@ -50,7 +50,7 @@
/**
* Constructor.
- * @see ProtocolRegistrationBroker#getRegistry
+ * @see ProtocolRegistrationBroker#getStrategy
*/
public PropertyProtocolRegistration() {
}
Modified: trunk/foray/foray-common/src/java/org/foray/common/url/ProtocolRegistrationBroker.java
===================================================================
--- trunk/foray/foray-common/src/java/org/foray/common/url/ProtocolRegistrationBroker.java 2006-07-08 02:27:21 UTC (rev 7767)
+++ trunk/foray/foray-common/src/java/org/foray/common/url/ProtocolRegistrationBroker.java 2006-07-08 02:38:24 UTC (rev 7768)
@@ -27,28 +27,32 @@
package org.foray.common.url;
/**
- * Class that returns an instance of ProtocolHandlerRegistry which is
- * unique within the whole application.
+ * Manages which {@link ProtocolRegistrationStrategy} is used to register new
+ * custom URL protocol handlers.
*/
public class ProtocolRegistrationBroker {
- /** The singleton instance of ProtocolHandlerRegistry. */
- private static ProtocolRegistrationStrategy registry = null;
+ /** The singleton instance of {@link ProtocolRegistrationStrategy}. */
+ private static ProtocolRegistrationStrategy strategy = null;
/**
- * Sets the registry which will be used within the application for
- * registering custom URL protocol handlers. This method may be called only
- * once at the beginning, before any call to the {@link #getRegistry}
- * method.
- * @param registry the registry used to record custom URL protocol handlers
+ * Sets the strategy which will be used within the application for
+ * registering custom URL protocol handlers.
+ * This method is provided to accommodate applications that prefer a custom
+ * strategy over the default strategy.
+ * The default strategy is {@link UniversalProtocolRegistration}, and it
+ * will be selected automatically unless this method is used to set a
+ * different strategy <em>before the first call</em> to the
+ * {@link #getStrategy} method.
+ * @param strategy the registry used to record custom URL protocol handlers
*/
- public static synchronized void setRegistry(
- ProtocolRegistrationStrategy registry) {
- if (registry != null) {
- throw new RuntimeException("ProtocolHandlerRegistryBroker: "
- + "registry already set");
+ public static synchronized void setStrategy(
+ ProtocolRegistrationStrategy strategy) {
+ if (strategy != null) {
+ String className = ProtocolRegistrationBroker.class.getName();
+ throw new RuntimeException(className + ": strategy already set");
}
- ProtocolRegistrationBroker.registry = registry;
+ ProtocolRegistrationBroker.strategy = strategy;
}
/**
@@ -56,11 +60,11 @@
* registering it with Java if needed.
* @return The custom ProtocolHandlerRegistry instance for this session.
*/
- public static synchronized ProtocolRegistrationStrategy getRegistry() {
- if (registry == null) {
- registry = new UniversalProtocolRegistration();
+ public static synchronized ProtocolRegistrationStrategy getStrategy() {
+ if (strategy == null) {
+ strategy = new UniversalProtocolRegistration();
}
- return registry;
+ return strategy;
}
}
Modified: trunk/foray/foray-common/src/java/org/foray/common/url/classpath/Handler.java
===================================================================
--- trunk/foray/foray-common/src/java/org/foray/common/url/classpath/Handler.java 2006-07-08 02:27:21 UTC (rev 7767)
+++ trunk/foray/foray-common/src/java/org/foray/common/url/classpath/Handler.java 2006-07-08 02:38:24 UTC (rev 7768)
@@ -81,7 +81,7 @@
if (!alreadyRegistered) {
URLStreamHandler handler = new Handler();
ProtocolRegistrationStrategy registry =
- ProtocolRegistrationBroker.getRegistry();
+ ProtocolRegistrationBroker.getStrategy();
registry.registerProtocolHandler(Handler.PROTOCOL, handler);
alreadyRegistered = true;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|