[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[List Home]
|
[jetty-commit] r1203 - in jetty/trunk/jetty-deploy/src/main/java/org/eclipse/jetty/deploy: . providers
|
- From: genie@xxxxxxxxxxx
- Date: Mon, 18 Jan 2010 17:06:53 -0500 (EST)
- Delivered-to: jetty-commit@eclipse.org
Author: gwilkins
Date: 2010-01-18 17:06:52 -0500 (Mon, 18 Jan 2010)
New Revision: 1203
Modified:
jetty/trunk/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/App.java
jetty/trunk/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/providers/ScanningAppProvider.java
Log:
format
Modified: jetty/trunk/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/App.java
===================================================================
--- jetty/trunk/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/App.java 2010-01-18 03:21:33 UTC (rev 1202)
+++ jetty/trunk/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/App.java 2010-01-18 22:06:52 UTC (rev 1203)
@@ -44,34 +44,36 @@
* Create an App with specified Origin ID and archivePath
*
* @param originId
- * the origin ID (The ID that the {@link AppProvider} knows about)
+ * the origin ID (The ID that the {@link AppProvider} knows
+ * about)
* @see App#getOriginId()
* @see App#getContextId()
*/
public App(DeploymentManager manager, AppProvider provider, String originId)
{
- _manager=manager;
+ _manager = manager;
_provider = provider;
_originId = originId;
}
-
+
/**
* Create an App with specified Origin ID and archivePath
*
* @param originId
- * the origin ID (The ID that the {@link AppProvider} knows about)
+ * the origin ID (The ID that the {@link AppProvider} knows
+ * about)
* @see App#getOriginId()
* @see App#getContextId()
- * @param context Some implementations of AppProvider might have to use an already created ContextHandler.
+ * @param context
+ * Some implementations of AppProvider might have to use an
+ * already created ContextHandler.
*/
public App(DeploymentManager manager, AppProvider provider, String originId, ContextHandler context)
{
- this(manager, provider, originId);
+ this(manager,provider,originId);
_context = context;
}
-
-
/* ------------------------------------------------------------ */
/**
* @return The deployment manager
@@ -89,28 +91,30 @@
{
return _provider;
}
-
+
/**
* Get ContextHandler for the App.
*
* Create it if needed.
*
- * @return the {@link ContextHandler} to use for the App when fully started. (Portions of which might be ignored
- * when App is in the {@link AppState#STAGED} state}
+ * @return the {@link ContextHandler} to use for the App when fully started.
+ * (Portions of which might be ignored when App is in the
+ * {@link AppState#STAGED} state}
* @throws Exception
*/
public ContextHandler getContextHandler() throws Exception
{
if (_context == null)
{
- _context=getAppProvider().createContextHandler(this);
+ _context = getAppProvider().createContextHandler(this);
this._context.setAttributes(new AttributesMap(_manager.getContextAttributes()));
}
return _context;
}
/**
- * The unique id of the {@link App} relating to how it is installed on the jetty server side.
+ * The unique id of the {@link App} relating to how it is installed on the
+ * jetty server side.
*
* @return the generated Id for the App.
*/
@@ -132,10 +136,10 @@
{
return this._originId;
}
-
+
@Override
public String toString()
{
- return "App["+_context+","+_originId+"]";
+ return "App[" + _context + "," + _originId + "]";
}
}
Modified: jetty/trunk/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/providers/ScanningAppProvider.java
===================================================================
--- jetty/trunk/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/providers/ScanningAppProvider.java 2010-01-18 03:21:33 UTC (rev 1202)
+++ jetty/trunk/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/providers/ScanningAppProvider.java 2010-01-18 22:06:52 UTC (rev 1203)
@@ -30,86 +30,89 @@
import org.eclipse.jetty.util.resource.Resource;
/**
- * Abstract for AppProviders that monitor context files.
- * The context file enables adminsitrators to customize the configuration of a WebAppContext or
- * a ContextHandler without chaging files inside the packaged application.
+ * Abstract for AppProviders that monitor context files. The context file
+ * enables adminsitrators to customize the configuration of a WebAppContext or a
+ * ContextHandler without chaging files inside the packaged application.
* <p>
- * When the context file is changed, the corresponding application is redeployed.
+ * When the context file is changed, the corresponding application is
+ * redeployed.
* </p>
*/
public abstract class ScanningAppProvider extends AbstractLifeCycle implements AppProvider
{
- private Map<String,App> _appMap = new HashMap<String,App>();
-
+ private Map<String, App> _appMap = new HashMap<String, App>();
+
private DeploymentManager _deploymentManager;
protected final FilenameFilter _filenameFilter;
private Resource _monitoredDir;
private boolean _recursive = false;
private int _scanInterval = 10;
private Scanner _scanner;
-
+
private final Scanner.DiscreteListener _scannerListener = new Scanner.DiscreteListener()
{
public void fileAdded(String filename) throws Exception
{
- Log.debug("added ", filename);
+ Log.debug("added ",filename);
App app = ScanningAppProvider.this.createApp(filename);
if (app != null)
{
- _appMap.put(filename,app);
- _deploymentManager.addApp(app);
+ _appMap.put(filename,app);
+ _deploymentManager.addApp(app);
}
}
public void fileChanged(String filename) throws Exception
{
- Log.debug("changed ", filename);
+ Log.debug("changed ",filename);
App app = _appMap.remove(filename);
- if (app!=null)
+ if (app != null)
_deploymentManager.removeApp(app);
app = ScanningAppProvider.this.createApp(filename);
if (app != null)
{
- _appMap.put(filename,app);
- _deploymentManager.addApp(app);
+ _appMap.put(filename,app);
+ _deploymentManager.addApp(app);
}
}
public void fileRemoved(String filename) throws Exception
{
- Log.debug("removed ", filename);
+ Log.debug("removed ",filename);
App app = _appMap.remove(filename);
- if (app!=null)
+ if (app != null)
_deploymentManager.removeApp(app);
}
};
-
+
protected ScanningAppProvider(FilenameFilter filter)
{
_filenameFilter = filter;
}
-
+
/**
* @return The index of currently deployed applications.
*/
- protected Map<String,App> getDeployedApps()
+ protected Map<String, App> getDeployedApps()
{
return _appMap;
}
-
+
/**
* Called by the Scanner.DiscreteListener to create a new App object.
- * Isolated in a method so that it is possible to override the default App object
- * for specialized implementations of the AppProvider.
- * @param filename The file that is the context.xml.
- * It is resolved by {@link Resource#newResource(String)}
+ * Isolated in a method so that it is possible to override the default App
+ * object for specialized implementations of the AppProvider.
+ *
+ * @param filename
+ * The file that is the context.xml. It is resolved by
+ * {@link Resource#newResource(String)}
* @return The App object for this particular context definition file.
*/
protected App createApp(String filename)
{
- return new App(_deploymentManager,this,filename);
+ return new App(_deploymentManager,this,filename);
}
-
+
@Override
protected void doStart() throws Exception
{
@@ -120,8 +123,8 @@
}
File scandir = _monitoredDir.getFile();
- Log.info("Deployment monitor " + scandir+ " at intervale "+_scanInterval);
- _scanner=new Scanner();
+ Log.info("Deployment monitor " + scandir + " at intervale " + _scanInterval);
+ _scanner = new Scanner();
_scanner.setScanDirs(Collections.singletonList(scandir));
_scanner.setScanInterval(_scanInterval);
_scanner.setRecursive(_recursive);
@@ -137,11 +140,13 @@
{
_scanner.stop();
_scanner.removeListener(_scannerListener);
- _scanner=null;
+ _scanner = null;
}
/* ------------------------------------------------------------ */
- /** Get the deploymentManager.
+ /**
+ * Get the deploymentManager.
+ *
* @return the deploymentManager
*/
public DeploymentManager getDeploymentManager()
@@ -160,7 +165,7 @@
{
return _scanInterval;
}
-
+
/* ------------------------------------------------------------ */
public boolean isRecursive()
{
@@ -172,13 +177,14 @@
{
_deploymentManager = deploymentManager;
}
+
/* ------------------------------------------------------------ */
public void setMonitoredDir(Resource contextsDir)
{
_monitoredDir = contextsDir;
}
-
+
/* ------------------------------------------------------------ */
/**
* @param dir