weaver 2004/01/15 14:26:22
Modified: portal/src/java/org/apache/jetspeed/tools/pamanager
Deployment.java CatalinaPAM.java FileSystemPAM.java
portal/src/java/org/apache/jetspeed/deployment/fs
FileSystemScanner.java
portal/src/test/org/apache/jetspeed/deployment
TestSimpleDeployment.java
Log:
- added a new method signature to Deployment that was in FileSystemPAM but not in
the interface
- Added a second constructor to FIleSystemPAM to a allow a DB alias to be passed in
- TestSimpleDeployment sets up the test db location correctly dor the FileSystemPAM
Revision Changes Path
1.2 +3 -1
jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/tools/pamanager/Deployment.java
Index: Deployment.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/tools/pamanager/Deployment.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Deployment.java 28 Jul 2003 23:47:52 -0000 1.1
+++ Deployment.java 15 Jan 2004 22:26:22 -0000 1.2
@@ -87,6 +87,8 @@
*/
public void deploy(String warFile,
String paName) throws PortletApplicationException;
+
+ public void deploy(String webAppsDir, String warFile, String paName, String
deploymentDbAlias, int startState) throws PortletApplicationException;
/**
* Undeploys application.
1.4 +25 -2
jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/tools/pamanager/CatalinaPAM.java
Index: CatalinaPAM.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/tools/pamanager/CatalinaPAM.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- CatalinaPAM.java 15 Jan 2004 20:29:42 -0000 1.3
+++ CatalinaPAM.java 15 Jan 2004 22:26:22 -0000 1.4
@@ -220,13 +220,36 @@
throw new PortletApplicationException(e);
}
}
-
+
+ /**
+ *
+ * @param response
+ * @throws PortletApplicationException
+ */
private void checkResponse(String response) throws PortletApplicationException
{
if (response == null || !response.startsWith("OK"))
{
throw new PortletApplicationException("Catalina container action
failed, \"" + response + "\"");
}
+ }
+
+ /**
+ * @see org.apache.jetspeed.tools.pamanager.Deployment#deploy(java.lang.String,
java.lang.String, java.lang.String, java.lang.String, int)
+ */
+ public void deploy(String webAppsDir, String warFile, String paName, String
deploymentDbAlias, int startState)
+ throws PortletApplicationException
+ {
+
+ super.deploy(webAppsDir, warFile, paName, deploymentDbAlias, startState);
+ try
+ {
+ checkResponse(tomcatManager.install(warFile, paName));
+ }
+ catch (Exception e)
+ {
+ throw new PortletApplicationException(e);
+ }
}
}
1.13 +12 -1
jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/tools/pamanager/FileSystemPAM.java
Index: FileSystemPAM.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/tools/pamanager/FileSystemPAM.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- FileSystemPAM.java 15 Jan 2004 16:09:08 -0000 1.12
+++ FileSystemPAM.java 15 Jan 2004 22:26:22 -0000 1.13
@@ -88,6 +88,17 @@
private String deploymentDbAlias;
private static final Log log = LogFactory.getLog("deployment");
+
+ public FileSystemPAM()
+ {
+ super();
+ }
+
+ public FileSystemPAM(String deploymentDbAlias)
+ {
+ this.deploymentDbAlias = deploymentDbAlias;
+ }
+
/**
* <p>
1.2 +13 -23
jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/deployment/fs/FileSystemScanner.java
Index: FileSystemScanner.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/deployment/fs/FileSystemScanner.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- FileSystemScanner.java 14 Jan 2004 19:32:57 -0000 1.1
+++ FileSystemScanner.java 15 Jan 2004 22:26:22 -0000 1.2
@@ -62,8 +62,6 @@
import java.util.Map;
import java.util.Set;
-import org.apache.commons.configuration.Configuration;
-import org.apache.commons.configuration.PropertiesConfiguration;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.jetspeed.deployment.DeploymentEvent;
@@ -90,31 +88,25 @@
private Map fileDates;
private boolean started = true;
private List deployedFiles;
- private String configPath;
private static final Log log = LogFactory.getLog(FileSystemScanner.class);
- public FileSystemScanner(
- String directoryToWatch,
- Map fileTypeHandlers,
- DeploymentEventDispatcher dispatcher,
- long delay,
- String configPath) throws FileNotFoundException, IOException
+ public FileSystemScanner(String directoryToWatch, Map fileTypeHandlers,
DeploymentEventDispatcher dispatcher, long delay)
+ throws FileNotFoundException, IOException
{
this.directoryToWatch = directoryToWatch;
this.directoryToWatchFile = new File(directoryToWatch);
- if(!directoryToWatchFile.exists())
+ if (!directoryToWatchFile.exists())
{
- throw new
FileNotFoundException(directoryToWatchFile.getCanonicalFile()+" does not exist.");
+ throw new FileNotFoundException(directoryToWatchFile.getCanonicalFile()
+ " does not exist.");
}
this.fileTypeHandlers = fileTypeHandlers;
this.delay = delay;
this.dispatcher = dispatcher;
this.deployedFiles = new ArrayList();
- this.configPath = configPath;
Set fileExtensions = fileTypeHandlers.keySet();
- this.filter = new AllowedFileTypeFilter((String[])
fileExtensions.toArray(new String[1]));
+ this.filter = new AllowedFileTypeFilter((String[])
fileExtensions.toArray(new String[1]));
setPriority(MIN_PRIORITY);
}
@@ -159,14 +151,12 @@
File aFile = stagedFiles[i];
if (!isDeployed(aFile))
{
-
-
+
try
{
- FSObjectHandler objHandler =
getFSObjectHandler(aFile);
-
- DeploymentEvent event =
- new DeploymentEventImpl(DeploymentEvent.EVENT_TYPE_DEPLOY,
objHandler);
+ FSObjectHandler objHandler = getFSObjectHandler(aFile);
+
+ DeploymentEvent event = new
DeploymentEventImpl(DeploymentEvent.EVENT_TYPE_DEPLOY, objHandler);
dispatcher.dispatch(event);
// we are responsible for reclaiming the FSObject's resource
objHandler.close();
@@ -201,7 +191,7 @@
protected File[] getStagedFiles()
{
return this.directoryToWatchFile.listFiles(this.filter);
- // return this.directoryToWatchFile.listFiles();
+ // return this.directoryToWatchFile.listFiles();
}
protected FSObjectHandler getFSObjectHandler(File file) throws Exception
@@ -211,8 +201,8 @@
if (extIndex != -1 && (extIndex + 1) < name.length())
{
String extension = name.substring(extIndex + 1);
- Class fsoClass = (Class) fileTypeHandlers.get(extension);
- FSObjectHandler fso = (FSObjectHandler) fsoClass.newInstance();
+ Class fsoClass = (Class) fileTypeHandlers.get(extension);
+ FSObjectHandler fso = (FSObjectHandler) fsoClass.newInstance();
fso.setFile(file);
return fso;
}
1.3 +7 -7
jakarta-jetspeed-2/portal/src/test/org/apache/jetspeed/deployment/TestSimpleDeployment.java
Index: TestSimpleDeployment.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed-2/portal/src/test/org/apache/jetspeed/deployment/TestSimpleDeployment.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TestSimpleDeployment.java 15 Jan 2004 16:15:23 -0000 1.2
+++ TestSimpleDeployment.java 15 Jan 2004 22:26:22 -0000 1.3
@@ -7,7 +7,6 @@
package org.apache.jetspeed.deployment;
import java.io.File;
-import java.io.IOException;
import java.util.HashMap;
import junit.framework.AssertionFailedError;
@@ -15,7 +14,6 @@
import junit.framework.TestSuite;
import org.apache.commons.configuration.Configuration;
-import org.apache.jetspeed.Jetspeed;
import org.apache.jetspeed.deployment.fs.FileSystemScanner;
import org.apache.jetspeed.deployment.fs.JARObjectHandlerImpl;
import org.apache.jetspeed.deployment.impl.DeployDecoratorEventListener;
@@ -101,13 +99,13 @@
DeploymentEventDispatcher ded = new DeploymentEventDispatcher(deployRoot);
SimpleRegistry registry = new InMemoryRegistryImpl();
DeployDecoratorEventListener ddel = new
DeployDecoratorEventListener(registry);
- DeployPortletAppEventListener dpal = new
DeployPortletAppEventListener(webAppsDir, testDb);
+ DeployPortletAppEventListener dpal = new
DeployPortletAppEventListener(webAppsDir, testDb, new FileSystemPAM());
ded.addDeploymentListener(ddel);
ded.addDeploymentListener(dpal);
HashMap handlers = new HashMap();
handlers.put("jar", JARObjectHandlerImpl.class);
handlers.put("war", JARObjectHandlerImpl.class);
- FileSystemScanner fScanner = new FileSystemScanner(delpoySrc, handlers,
ded, 500, "decorator.properties");
+ FileSystemScanner fScanner = new FileSystemScanner(delpoySrc, handlers,
ded, 500);
fScanner.start();
Thread.sleep(10000);
fScanner.safeStop();
@@ -138,7 +136,9 @@
webAppsDir = new File("./test/deployment/webapps").getCanonicalPath();
testDb = new File("./test/db/hsql/Registry").getCanonicalPath();
// remove any prior left overs
- FileSystemPAM pam = new FileSystemPAM();
+
+ FileSystemPAM pam = new FileSystemPAM(testDb);
+
pam.undeploy(webAppsDir, TEST_PORTLET_APP_NAME);
}
catch (Exception e)
@@ -156,7 +156,7 @@
{
super.tearDown();
- FileSystemPAM pam = new FileSystemPAM();
+ FileSystemPAM pam = new FileSystemPAM(testDb);
try
{
pam.undeploy(webAppsDir, TEST_PORTLET_APP_NAME);
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]