Revision: 7761
Author: victormote
Date: 2006-07-07 18:58:47 -0700 (Fri, 07 Jul 2006)
ViewCVS: http://svn.sourceforge.net/foray/?rev=7761&view=rev
Log Message:
-----------
Rename class in preparation for refactoring it as ProtocolRegistrationStrategy implementation.
Added Paths:
-----------
trunk/foray/foray-common/src/java/org/foray/common/url/UniversalProtocolRegistration.java
Removed Paths:
-------------
trunk/foray/foray-common/src/java/org/foray/common/url/AbstractURLStreamHandler.java
Deleted: trunk/foray/foray-common/src/java/org/foray/common/url/AbstractURLStreamHandler.java
===================================================================
--- trunk/foray/foray-common/src/java/org/foray/common/url/AbstractURLStreamHandler.java 2006-07-08 01:53:53 UTC (rev 7760)
+++ trunk/foray/foray-common/src/java/org/foray/common/url/AbstractURLStreamHandler.java 2006-07-08 01:58:47 UTC (rev 7761)
@@ -1,94 +0,0 @@
-/*
- * Copyright 2006 The FOray Project.
- * http://www.foray.org
- *
- * 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.
- *
- * This work is in part derived from the following work(s), used with the
- * permission of the licensor:
- * Apache FOP, licensed by the Apache Software Foundation
- *
- */
-
-/* $Id$ */
-
-/* Known contributors:
- * Vincent Hennebert (original author)
- */
-
-package org.foray.common.url;
-
-
-import java.net.URLStreamHandler;
-
-/**
- * Abstract superclass for all URLStreamHandlers using the FOray scheme for
- * custom URLStreamHandler registration.
- */
-public abstract class AbstractURLStreamHandler extends URLStreamHandler {
-
- /**
- * Register an instance of this class with the custom
- * URLStreamHandlerFactory so that this handler will be used for URLs of
- * a specific type.
- * @param protocol The name of the protocol to register.
- * @param handler The handler that should be registered to handle URLs of
- * type <code>protocol</code>.
- */
- protected static void register(String protocol, URLStreamHandler handler) {
- /* Validate the input. */
- if (protocol == null) {
- return;
- }
- if (handler == null) {
- return;
- }
-
- /* Get the Factory instance. */
- FOrayURLStreamHandlerFactory factory =
- FOrayURLStreamHandlerFactory.getURLStreamHandlerFactory();
-
- if (factory == null) {
- /* If factory is null, it is because something got registered in
- * URL.setURLStreamHandlerFactory(URLStreamHandlerFactory)
- * before our FOrayURLStreamHandlerFactory could register.
- * Therefore, the best we can do is register ours with the Java
- * environment "java.protocol.handler.pkgs". */
- /* The FOray Factory will not be able to register itself with Java
- * in a case where other software running has already registered
- * another URLStreamHandlerFactory first.
- * Therefore, we will give Java another opportunity to find our
- * custom handler by placing its location in the Java environment.
- */
- PropertyProtocolRegistration.propertyRegistration(protocol,
- handler);
- return;
- }
-
- /* See if this protocol is already registered with the factory. */
- URLStreamHandler registeredHandler = factory.createURLStreamHandler(
- protocol);
- if (registeredHandler != null) {
- /* If already registed, that one is the one being used, and there
- * is no way to change it. If it has in fact not yet been used,
- * then registering this now would make the new one used instead
- * of the old one. However, until we have some indication that this
- * would be the "right" thing to do, we will not. */
- return;
- }
-
- /* Register the protocol with the Factory. */
- factory.registerProtocol(protocol, handler);
- }
-
-}
Copied: trunk/foray/foray-common/src/java/org/foray/common/url/UniversalProtocolRegistration.java (from rev 7760, trunk/foray/foray-common/src/java/org/foray/common/url/AbstractURLStreamHandler.java)
===================================================================
--- trunk/foray/foray-common/src/java/org/foray/common/url/UniversalProtocolRegistration.java (rev 0)
+++ trunk/foray/foray-common/src/java/org/foray/common/url/UniversalProtocolRegistration.java 2006-07-08 01:58:47 UTC (rev 7761)
@@ -0,0 +1,94 @@
+/*
+ * Copyright 2006 The FOray Project.
+ * http://www.foray.org
+ *
+ * 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.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/* $Id$ */
+
+/* Known contributors:
+ * Vincent Hennebert (original author)
+ */
+
+package org.foray.common.url;
+
+
+import java.net.URLStreamHandler;
+
+/**
+ * Abstract superclass for all URLStreamHandlers using the FOray scheme for
+ * custom URLStreamHandler registration.
+ */
+public abstract class UniversalProtocolRegistration extends URLStreamHandler {
+
+ /**
+ * Register an instance of this class with the custom
+ * URLStreamHandlerFactory so that this handler will be used for URLs of
+ * a specific type.
+ * @param protocol The name of the protocol to register.
+ * @param handler The handler that should be registered to handle URLs of
+ * type <code>protocol</code>.
+ */
+ protected static void register(String protocol, URLStreamHandler handler) {
+ /* Validate the input. */
+ if (protocol == null) {
+ return;
+ }
+ if (handler == null) {
+ return;
+ }
+
+ /* Get the Factory instance. */
+ FOrayURLStreamHandlerFactory factory =
+ FOrayURLStreamHandlerFactory.getURLStreamHandlerFactory();
+
+ if (factory == null) {
+ /* If factory is null, it is because something got registered in
+ * URL.setURLStreamHandlerFactory(URLStreamHandlerFactory)
+ * before our FOrayURLStreamHandlerFactory could register.
+ * Therefore, the best we can do is register ours with the Java
+ * environment "java.protocol.handler.pkgs". */
+ /* The FOray Factory will not be able to register itself with Java
+ * in a case where other software running has already registered
+ * another URLStreamHandlerFactory first.
+ * Therefore, we will give Java another opportunity to find our
+ * custom handler by placing its location in the Java environment.
+ */
+ PropertyProtocolRegistration.propertyRegistration(protocol,
+ handler);
+ return;
+ }
+
+ /* See if this protocol is already registered with the factory. */
+ URLStreamHandler registeredHandler = factory.createURLStreamHandler(
+ protocol);
+ if (registeredHandler != null) {
+ /* If already registed, that one is the one being used, and there
+ * is no way to change it. If it has in fact not yet been used,
+ * then registering this now would make the new one used instead
+ * of the old one. However, until we have some indication that this
+ * would be the "right" thing to do, we will not. */
+ return;
+ }
+
+ /* Register the protocol with the Factory. */
+ factory.registerProtocol(protocol, handler);
+ }
+
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|