Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Wilkins2010-01-18 22:06:52 +0000
committerGreg Wilkins2010-01-18 22:06:52 +0000
commit6cdd30390a44a9ae395b832b68e04e8c35f25ce4 (patch)
tree6f5ef1abf66f4696896ed2f35907e7d3ae5705d7 /jetty-deploy/src/main/java
parent0fe25eb3d78b64c9854f3eae81d3dfcc33792331 (diff)
downloadorg.eclipse.jetty.project-6cdd30390a44a9ae395b832b68e04e8c35f25ce4.tar.gz
org.eclipse.jetty.project-6cdd30390a44a9ae395b832b68e04e8c35f25ce4.tar.xz
org.eclipse.jetty.project-6cdd30390a44a9ae395b832b68e04e8c35f25ce4.zip
format
git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@1203 7e9141cc-0065-0410-87d8-b60c137991c4
Diffstat (limited to 'jetty-deploy/src/main/java')
-rw-r--r--jetty-deploy/src/main/java/org/eclipse/jetty/deploy/App.java34
-rw-r--r--jetty-deploy/src/main/java/org/eclipse/jetty/deploy/providers/ScanningAppProvider.java70
2 files changed, 57 insertions, 47 deletions
diff --git a/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/App.java b/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/App.java
index 8d44c55916..c881985096 100644
--- a/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/App.java
+++ b/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/App.java
@@ -44,34 +44,36 @@ public class App
* 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 @@ public class App
{
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 @@ public class App
{
return this._originId;
}
-
+
@Override
public String toString()
{
- return "App["+_context+","+_originId+"]";
+ return "App[" + _context + "," + _originId + "]";
}
}
diff --git a/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/providers/ScanningAppProvider.java b/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/providers/ScanningAppProvider.java
index af6324bc48..f26942bbb9 100644
--- a/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/providers/ScanningAppProvider.java
+++ b/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/providers/ScanningAppProvider.java
@@ -30,86 +30,89 @@ import org.eclipse.jetty.util.log.Log;
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 @@ public abstract class ScanningAppProvider extends AbstractLifeCycle implements A
}
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 @@ public abstract class ScanningAppProvider extends AbstractLifeCycle implements A
{
_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 @@ public abstract class ScanningAppProvider extends AbstractLifeCycle implements A
{
return _scanInterval;
}
-
+
/* ------------------------------------------------------------ */
public boolean isRecursive()
{
@@ -172,13 +177,14 @@ public abstract class ScanningAppProvider extends AbstractLifeCycle implements A
{
_deploymentManager = deploymentManager;
}
+
/* ------------------------------------------------------------ */
public void setMonitoredDir(Resource contextsDir)
{
_monitoredDir = contextsDir;
}
-
+
/* ------------------------------------------------------------ */
/**
* @param dir

Back to the top