User: d_jencks
Date: 02/04/13 18:19:54
Modified: src/main/org/jboss/deployment/scanner
URLDeploymentScanner.java
Log:
Larry Sanderson's patch to enable deploying unpacked directories
Revision Changes Path
1.13 +39 -27
jboss-system/src/main/org/jboss/deployment/scanner/URLDeploymentScanner.java
Index: URLDeploymentScanner.java
===================================================================
RCS file:
/cvsroot/jboss/jboss-system/src/main/org/jboss/deployment/scanner/URLDeploymentScanner.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- URLDeploymentScanner.java 13 Apr 2002 17:16:09 -0000 1.12
+++ URLDeploymentScanner.java 14 Apr 2002 01:19:54 -0000 1.13
@@ -40,7 +40,7 @@
*
* @jmx:mbean extends="org.jboss.deployment.scanner.DeploymentScannerMBean"
*
- * @version <tt>$Revision: 1.12 $</tt>
+ * @version <tt>$Revision: 1.13 $</tt>
* @author <a href="mailto:[EMAIL PROTECTED]">Jason Dillon</a>
*/
public class URLDeploymentScanner
@@ -236,10 +236,12 @@
/**
* A container and help class for a deployed URL.
+ * should be static at this point, with the explicit scanner ref, but I'm
(David) lazy.
*/
protected class DeployedURL
{
public URL url;
+ public URL watchUrl;
public long deployedLastModified;
public DeployedURL(final URL url)
@@ -251,7 +253,6 @@
{
deployedLastModified = getLastModified();
}
-
public boolean isFile()
{
return url.getProtocol().equals("file");
@@ -271,25 +272,43 @@
return false;
}
- public long getLastModified()
- {
- long lastModified = -1;
- try {
- if (isFile()) {
- File file = getFile();
- lastModified = file.lastModified();
- }
- else {
- URLConnection connection = url.openConnection();
- lastModified = connection.getLastModified();
- }
- }
- catch (java.io.IOException e) {
- log.warn("Failed to check modfication of deployed url: " + url, e);
- }
+ public long getLastModified()
+ {
+
+ if (watchUrl == null)
+ {
+ try {
+ Object o = getServer().invoke(getDeployer(), "getWatchUrl",
+ new Object[] { url },
+ new String[] { URL.class.getName() });
+ watchUrl = o == null ? url : (URL)o;
+ getLog().debug("Watch URL for: " + url + " -> " + watchUrl);
+ } catch (Exception e) {
+ watchUrl = url;
+ getLog().debug("Unable to obtain watchUrl from deployer. " +
+ "Use url: " + url, e);
+ }
+ }
+ try {
+ URLConnection connection;
+ if (watchUrl != null) {
+ connection = watchUrl.openConnection();
+ } else {
+ connection = url.openConnection();
+ }
+ // no need to do special checks for files...
+ // org.jboss.net.protocol.file.FileURLConnection correctly
+ // implements the getLastModified method.
+ long lastModified = connection.getLastModified();
+
+ return lastModified;
+ }
+ catch (java.io.IOException e) {
+ getLog().warn("Failed to check modfication of deployed url: " + url, e);
+ }
- return lastModified;
- }
+ return -1;
+ }
public boolean isModified()
{
@@ -487,13 +506,6 @@
for (int i = 0; i < files.length; i++)
{
- if (files[i].isDirectory()) {
- if (trace) {
- log.trace("Ignoring nested directory: " + files[i]);
- }
- continue;
- }
-
if (trace) {
log.trace("Checking deployment file: " + files[i]);
}
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development