Author: rob.stryker(a)jboss.com
Date: 2007-09-26 16:26:44 -0400 (Wed, 26 Sep 2007)
New Revision: 3824
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/PackagesPublisher.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/PublisherEventLogger.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DeployableServerBehavior.java
Log:
cleanup for publishing events
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/PackagesPublisher.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/PackagesPublisher.java 2007-09-26
19:40:35 UTC (rev 3823)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/PackagesPublisher.java 2007-09-26
20:26:44 UTC (rev 3824)
@@ -95,7 +95,7 @@
protected void removeModule(IModule module, int kind, int deltaKind, IProgressMonitor
monitor) {
IArchive pack = getPackage(module);
// remove all of the deployed items
- PublishEvent event = PublisherEventLogger.createSingleModuleTopEvent(eventRoot, module,
kind, deltaKind);
+ PublishEvent event = PublisherEventLogger.createModuleRootEvent(eventRoot, new
IModule[]{module}, kind, deltaKind);
if( pack != null ) {
IPath sourcePath = pack.getArchiveFilePath();
IPath destPath = new
Path(server.getDeployDirectory()).append(sourcePath.lastSegment());
@@ -108,7 +108,7 @@
protected void publishModule(IModule module, int kind, int deltaKind, int
modulePublishState, IProgressMonitor monitor) {
- PublishEvent event = PublisherEventLogger.createSingleModuleTopEvent(eventRoot, module,
kind, deltaKind);
+ PublishEvent event = PublisherEventLogger.createModuleRootEvent(eventRoot, new
IModule[]{module}, kind, deltaKind);
IArchive pack = getPackage(module);
IPath sourcePath = pack.getArchiveFilePath();
IPath destPathRoot = new Path(server.getDeployDirectory());
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/PublisherEventLogger.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/PublisherEventLogger.java 2007-09-26
19:40:35 UTC (rev 3823)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/PublisherEventLogger.java 2007-09-26
20:26:44 UTC (rev 3824)
@@ -2,6 +2,7 @@
import java.io.File;
+import org.eclipse.core.runtime.Path;
import org.eclipse.wst.server.core.IModule;
import org.jboss.ide.eclipse.as.core.extensions.events.EventLogModel;
import org.jboss.ide.eclipse.as.core.extensions.events.EventLogModel.EventLogTreeItem;
@@ -21,30 +22,26 @@
setProperty(MODULE_NAME, module.getName());
}
}
-
- // type
- public static final String MULTIPLE_MODULE_TOP_EVENT =
"org.jboss.ide.eclipse.as.core.publishers.PublisherEventLogger.MULTIPLE_MODULE_TOP_EVENT";
- // properties
- public static final String MULTIPLE_MODULE_MODULE_COUNT =
"org.jboss.ide.eclipse.as.core.publishers.PublisherEventLogger.MULTIPLE_MODULE_MODULE_COUNT";
-
- public static PublishEvent createMultipleModuleTopLevelEvent(EventLogTreeItem parent,
int numMods) {
- PublishEvent event = new PublishEvent(parent, MULTIPLE_MODULE_TOP_EVENT );
- event.setProperty(MULTIPLE_MODULE_MODULE_COUNT, new Integer(numMods));
- EventLogModel.markChanged(parent);
- return event;
+ public static PublishEvent createTopEvent(EventLogTreeItem parent) {
+ return new PublishEvent(parent, ROOT_EVENT);
}
// type
- public static final String SINGLE_MODULE_TOP_EVENT =
"org.jboss.ide.eclipse.as.core.publishers.PublisherEventLogger.SINGLE_MODULE_TOP_EVENT";
+ public static final String ROOT_EVENT =
"org.jboss.ide.eclipse.as.core.publishers.PublisherEventLogger.ROOT_EVENT";
+ public static final String MODULE_ROOT_EVENT =
"org.jboss.ide.eclipse.as.core.publishers.PublisherEventLogger.MODULE_ROOT_EVENT";
// properties
public static final String MODULE_KIND =
"org.jboss.ide.eclipse.as.core.publishers.PublisherEventLogger.MODULE_KIND";
public static final String DELTA_KIND =
"org.jboss.ide.eclipse.as.core.publishers.PublisherEventLogger.DELTA_KIND";
- public static PublishEvent createSingleModuleTopEvent(EventLogTreeItem parent, IModule
module, int kind, int deltaKind) {
- PublishEvent event = new PublishEvent(parent, SINGLE_MODULE_TOP_EVENT);
+ public static PublishEvent createModuleRootEvent(EventLogTreeItem parent, IModule[]
module, int kind, int deltaKind) {
+ PublishEvent event = new PublishEvent(parent, MODULE_ROOT_EVENT);
+ String name = "";
+ for( int i = 0; i < module.length; i++ ) {
+ name += module[i].getName() + Path.SEPARATOR;
+ }
event.setProperty(MODULE_KIND, new Integer(kind));
event.setProperty(DELTA_KIND, new Integer(deltaKind));
- event.setProperty(MODULE_NAME, module.getName());
+ event.setProperty(MODULE_NAME, name);
EventLogModel.markChanged(parent);
return event;
}
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DeployableServerBehavior.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DeployableServerBehavior.java 2007-09-26
19:40:35 UTC (rev 3823)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DeployableServerBehavior.java 2007-09-26
20:26:44 UTC (rev 3824)
@@ -30,6 +30,7 @@
import org.jboss.ide.eclipse.as.core.publishers.PackagesPublisher;
import org.jboss.ide.eclipse.as.core.publishers.PublisherEventLogger;
import org.jboss.ide.eclipse.as.core.publishers.SingleFilePublisher;
+import org.jboss.ide.eclipse.as.core.publishers.PublisherEventLogger.PublishEvent;
import org.jboss.ide.eclipse.as.core.server.IJBossServerPublisher;
import
org.jboss.ide.eclipse.as.core.server.internal.launch.DeployableLaunchConfiguration;
@@ -67,6 +68,17 @@
System.out.println(" to server " + getServer().getName() + "(" +
getServer().getId() + ")");
}
+ protected PublishEvent publishEvent;
+ protected void publishStart(IProgressMonitor monitor) throws CoreException {
+ EventLogTreeItem root = EventLogModel.getModel(getServer()).getRoot();
+ publishEvent = PublisherEventLogger.createTopEvent(root);
+ }
+
+ protected void publishFinish(IProgressMonitor monitor) throws CoreException {
+ publishEvent = null;
+ }
+
+
/*
* The module is a list of module trail points, from parent to child
* Thus:
@@ -82,35 +94,25 @@
IJBossServerPublisher publisher;
print(kind, deltaKind, module);
int modulePublishState = getServer().getModulePublishState(module) + 0;
-
- EventLogTreeItem root = EventLogModel.getModel(getServer()).getRoot();
- if( module.length > 1 ) {
- root = PublisherEventLogger.createMultipleModuleTopLevelEvent(root, module.length);
- }
-
+ PublishEvent root = PublisherEventLogger.createModuleRootEvent(publishEvent, module,
kind, deltaKind);
+
if( module.length > 0 ) {
IModule lastMod = module[module.length -1];
- try {
- if( isJstModule(lastMod) ) {
- publisher = new JstPublisher(getServer(), root);
- } else if( isPackagesTypeModule(lastMod) ) {
- publisher = new PackagesPublisher(getServer(), root);
- } else if( lastMod.getModuleType().getId().equals("jboss.singlefile")){
- publisher = new SingleFilePublisher(getServer());
- } else {
- publisher = new NullPublisher();
- }
- publisher.setDelta(getPublishedResourceDelta(module));
- publisher.publishModule(kind, deltaKind, modulePublishState, module, monitor);
- setModulePublishState(module, publisher.getPublishState());
- } catch( Throwable e ) {
- e.printStackTrace();
+ if( isJstModule(lastMod) ) {
+ publisher = new JstPublisher(getServer(), root);
+ } else if( isPackagesTypeModule(lastMod) ) {
+ publisher = new PackagesPublisher(getServer(), root);
+ } else if( lastMod.getModuleType().getId().equals("jboss.singlefile")){
+ publisher = new SingleFilePublisher(getServer());
+ } else {
+ publisher = new NullPublisher();
}
+ publisher.setDelta(getPublishedResourceDelta(module));
+ publisher.publishModule(kind, deltaKind, modulePublishState, module, monitor);
+ setModulePublishState(module, publisher.getPublishState());
}
}
-
-
/* Temporary and will need to be fixed */
// TODO: Change to if it is a flex project. Don't know how to do that yet.
protected boolean isJstModule(IModule mod) {