Author: rob.stryker(a)jboss.com
Date: 2007-09-24 13:05:58 -0400 (Mon, 24 Sep 2007)
New Revision: 3773
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/NullPublisher.java
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/SingleFilePublisher.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DeployableServerBehavior.java
Log:
Change allowing children to be seen in view
WTP Publishing re-written to accomodate change
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java 2007-09-24
17:05:07 UTC (rev 3772)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java 2007-09-24
17:05:58 UTC (rev 3773)
@@ -23,7 +23,6 @@
import java.io.File;
import java.io.IOException;
-import java.util.ArrayList;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
@@ -33,11 +32,8 @@
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.jst.server.core.IEnterpriseApplication;
-import org.eclipse.jst.server.core.IWebModule;
import org.eclipse.wst.server.core.IModule;
import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.internal.DeletedModule;
-import org.eclipse.wst.server.core.internal.Server;
import org.eclipse.wst.server.core.model.IModuleFolder;
import org.eclipse.wst.server.core.model.IModuleResource;
import org.eclipse.wst.server.core.model.IModuleResourceDelta;
@@ -48,9 +44,10 @@
import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
import org.jboss.ide.eclipse.as.core.extensions.events.EventLogModel.EventLogTreeItem;
import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
-import org.jboss.ide.eclipse.as.core.server.internal.NestedPublishInfo;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerPublisher;
import org.jboss.ide.eclipse.as.core.server.xpl.ModulePackager;
import org.jboss.ide.eclipse.as.core.util.FileUtil;
+import org.jboss.ide.eclipse.as.core.util.ServerConverter;
/**
* This class provides a default implementation for packaging different types of
@@ -58,266 +55,105 @@
*
* @author rob.stryker(a)jboss.com
*/
-public class JstPublisher extends PackagesPublisher {
+public class JstPublisher implements IJBossServerPublisher {
public static final int BUILD_FAILED_CODE = 100;
public static final int PACKAGE_UNDETERMINED_CODE = 101;
protected IModuleResourceDelta[] delta;
+ protected IDeployableServer server;
+ protected EventLogTreeItem eventRoot;
- public JstPublisher(IServer server, EventLogTreeItem context) {
- super(server, context);
- }
+ public JstPublisher(IDeployableServer server, EventLogTreeItem context) {
+ this.server = server;
+ eventRoot = context;
+ }
+ public JstPublisher(IServer server, EventLogTreeItem eventContext) {
+ this( ServerConverter.getDeployableServer(server), eventContext);
+ }
public void setDelta(IModuleResourceDelta[] delta) {
this.delta = delta;
}
public IStatus publishModule(int kind, int deltaKind,
- int modulePublishState, IModule module, IProgressMonitor monitor)
+ int modulePublishState, IModule[] module, IProgressMonitor monitor)
throws CoreException {
IStatus status = null;
- IPath root = new Path(server.getDeployDirectory());
if (ServerBehaviourDelegate.REMOVED == deltaKind) {
status = unpublish(server, module, monitor);
} else if (kind == IServer.PUBLISH_FULL || kind == IServer.PUBLISH_CLEAN) {
- status = fullPublishPackIntoFolder(new ArrayList<IModule>(), root, module,
monitor);
- } else if (kind == IServer.PUBLISH_INCREMENTAL) {
- status = incrementalPublish(new ArrayList<IModule>(), root, module, monitor);
+ status = fullPublish(module, module[module.length-1], monitor);
+ } else if (kind == IServer.PUBLISH_INCREMENTAL || kind == IServer.PUBLISH_AUTO) {
+ status = incrementalPublish(module, module[module.length-1], monitor);
}
return status;
}
- protected IStatus fullPublishPackIntoFolder(ArrayList<IModule> moduleTree, IPath
root, IModule module, IProgressMonitor monitor) throws CoreException {
- if( module.getModuleType().getId().equals("jst.ear")) {
- fullEarPublish(moduleTree, module, root, monitor);
- } else if( module.getModuleType().getId().equals("jst.web")) {
- fullWebPublish(moduleTree, module, root, monitor);
- } else if( module.getModuleType().getId().equals("jst.ejb")) {
- // This should be an ejb. Utility projects should not be published in a folder
- ModuleDelegate md = (ModuleDelegate)module.loadAdapter(ModuleDelegate.class,
monitor);
- IModuleResource[] members = md.members();
- IPath moduleDeployPath = root.append(module.getProject().getName() +
".jar");
- FileUtil.safeDelete(moduleDeployPath.toFile());
- PublishUtil.publishSmart(members, moduleDeployPath, monitor);
+ protected IStatus fullPublish(IModule[] moduleTree, IModule module, IProgressMonitor
monitor) throws CoreException {
+ IPath deployPath = getDeployPath(moduleTree);
+ ModuleDelegate md = (ModuleDelegate)module.loadAdapter(ModuleDelegate.class, monitor);
+ IModuleResource[] members = md.members();
+ FileUtil.safeDelete(deployPath.toFile());
+ if( !deployPackaged(moduleTree))
+ PublishUtil.publishFull(members, deployPath, monitor);
+ else
+ packModuleIntoJar(moduleTree[moduleTree.length-1], getDeployPath(moduleTree));
- // if we're nested, save our resources
- if( moduleTree.size() > 1 )
- NestedPublishInfo.getDefault().getServerPublishInfo(server.getServer()).getPublishInfo(moduleTree,
module).setResources(md.members());
-
- // can ejb jars have children? I don't know
- // TODO: FIND OUT!
- }
return null;
}
-
-
- /*
- * Full publish methods are here
- */
-
- protected void fullEarPublish(ArrayList<IModule> moduleTree, IModule module, IPath
root, IProgressMonitor monitor) throws CoreException {
- if( module instanceof DeletedModule ) {
- // TODO FIX ME
- return;
- }
+ protected IStatus incrementalPublish(IModule[] moduleTree, IModule module,
IProgressMonitor monitor) throws CoreException {
+ if( !deployPackaged(moduleTree))
+ PublishUtil.publishDelta(delta, getDeployPath(moduleTree), monitor);
+ else if( delta.length > 0 )
+ packModuleIntoJar(moduleTree[moduleTree.length-1], getDeployPath(moduleTree));
- ModuleDelegate md = (ModuleDelegate)module.loadAdapter(ModuleDelegate.class, monitor);
- IModuleResource[] members = md.members();
- IEnterpriseApplication earModule =
(IEnterpriseApplication)module.loadAdapter(IEnterpriseApplication.class, monitor);
- IPath moduleDeployPath = root.append(module.getProject().getName() +
".ear");
- FileUtil.safeDelete(moduleDeployPath.toFile());
- PublishUtil.publishFull(members, moduleDeployPath, monitor);
-
- // Add this module to the tree, so that when we get to the war or ejb
- // child, it knows it is the child of an ear and not a root deployment
- ArrayList<IModule> newTree = new ArrayList<IModule>();
- newTree.addAll(moduleTree);
- newTree.add(module);
-
- // if we're not the root (unlikely), save our resources
- boolean isRoot = moduleTree.size() == 1;
- if( !isRoot ) {
- NestedPublishInfo.getDefault().getServerPublishInfo(server.getServer()).getPublishInfo(newTree,
module).setResources(md.members());
- }
-
- // now lets fully publish the children
- IModule[] childModules = earModule.getModules();
- for (int i = 0; i < childModules.length; i++) {
- IModule module2 = childModules[i];
- String uri = earModule.getURI(module2);
- if(uri==null){
- IStatus status = new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID,
0, "unable to assemble module null uri",null ); //$NON-NLS-1$
- throw new CoreException(status);
- }
- if( module2.getModuleType().getId().equals("jst.utility")) {
- // utility gets packed into a jar
- packModuleIntoJar(module2, uri, moduleDeployPath);
- } else {
- // otherwise it's an ejb, a war, etc, and gets sent exploded
- fullPublishPackIntoFolder(newTree, moduleDeployPath, module2, monitor);
- }
- }
- }
-
-
-
- protected void fullWebPublish(ArrayList<IModule> moduleTree, IModule module, IPath
root, IProgressMonitor monitor ) throws CoreException {
- ModuleDelegate md = (ModuleDelegate)module.loadAdapter(ModuleDelegate.class, monitor);
- IModuleResource[] members = md.members();
- IWebModule webmodule = (IWebModule)module.loadAdapter(IWebModule.class, monitor);
- IPath moduleDeployPath = root.append(webmodule.getContextRoot() + ".war");
- FileUtil.safeDelete(moduleDeployPath.toFile());
- PublishUtil.publishSmart(members, moduleDeployPath, monitor);
-
- // save our resources if we're not a top level deployment
- if( moduleTree.size() != 1 )
- NestedPublishInfo.getDefault().getServerPublishInfo(server.getServer()).getPublishInfo(moduleTree,
module).setResources(md.members());
-
-
- IWebModule webModule = (IWebModule)module.loadAdapter(IWebModule.class, monitor);
- IModule[] childModules = webModule.getModules();
- for (int i = 0; i < childModules.length; i++) {
- IModule module2 = childModules[i];
- packModuleIntoJar(module, webModule.getURI(module2), moduleDeployPath);
- }
- }
-
-
- /*
- * Entry point for incremental publishing
- */
-
- protected IStatus incrementalPublish(ArrayList<IModule> moduleTree, IPath root,
IModule module, IProgressMonitor monitor) throws CoreException {
- if( module.getModuleType().getId().equals("jst.ear")) {
- incrementalEarPublish(moduleTree, module, root, monitor);
- } else if( module.getModuleType().getId().equals("jst.web")) {
- incrementalWarPublish(moduleTree, module, root, monitor);
- } else if( module.getModuleType().getId().equals("jst.ejb")){
- ArrayList newTree = new ArrayList(); newTree.addAll(moduleTree); newTree.add(module);
- IModuleResourceDelta[] deltas = getDelta(module, newTree);
- ModuleDelegate md = (ModuleDelegate)module.loadAdapter(ModuleDelegate.class,
monitor);
- IPath moduleDeployPath = root.append(module.getProject().getName() +
".jar");
- PublishUtil.publishDelta(deltas, moduleDeployPath, monitor);
-
- if( moduleTree.size() > 1 ) {
- NestedPublishInfo.getDefault().getServerPublishInfo(server.getServer()).getPublishInfo(newTree,
module).setResources(md.members());
- }
-
- // Can ears have libs in them? DO NOT KNOW
- // TODO: FIGURE IT OUT
- } else {
- // cannot incrementally publish something unknown
- // just package it normal
- packModuleIntoJar(module, module.getName() + ".jar", root);
- }
return new Status(IStatus.OK, JBossServerCorePlugin.PLUGIN_ID,
IStatus.OK, "", null);
}
- protected void incrementalEarPublish(ArrayList<IModule> moduleTree, IModule
module, IPath root, IProgressMonitor monitor) throws CoreException {
- ArrayList<IModule> newTree = new ArrayList<IModule>();
- newTree.addAll(moduleTree);
- newTree.add(module);
-
- IModuleResourceDelta[] deltas = getDelta(module, newTree);
- IEnterpriseApplication earModule =
(IEnterpriseApplication)module.loadAdapter(IEnterpriseApplication.class, monitor);
- IPath moduleDeployPath = root.append(module.getProject().getName() +
".ear");
- PublishUtil.publishDelta(deltas, moduleDeployPath, monitor);
-
- // if not root, save child data
- ModuleDelegate md = (ModuleDelegate)module.loadAdapter(ModuleDelegate.class, monitor);
- if( moduleTree.size() > 1 )
- NestedPublishInfo.getDefault().getServerPublishInfo(server.getServer()).getPublishInfo(newTree,
module).setResources(md.members());
-
- IModule[] childModules = earModule.getModules();
- for (int i = 0; i < childModules.length; i++) {
- IModule childModule = childModules[i];
- String uri = earModule.getURI(childModule);
- if(uri==null){
- IStatus status = new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID,
0, "unable to assemble module null uri",null ); //$NON-NLS-1$
- throw new CoreException(status);
- }
-
- incrementalPublish(newTree, moduleDeployPath, childModule, monitor);
- }
-
- }
-
- protected void incrementalWarPublish(ArrayList<IModule> moduleTree, IModule
module, IPath root, IProgressMonitor monitor) throws CoreException {
- ArrayList<IModule> newTree = new ArrayList<IModule>();
- newTree.addAll(moduleTree); newTree.add(module);
-
- IModuleResourceDelta[] deltas = getDelta(module, newTree);
- ModuleDelegate md = (ModuleDelegate)module.loadAdapter(ModuleDelegate.class, monitor);
- IWebModule webmodule = (IWebModule)module.loadAdapter(IWebModule.class, monitor);
- IPath moduleDeployPath = root.append(webmodule.getContextRoot() + ".war");
- PublishUtil.publishDelta(deltas, moduleDeployPath, monitor);
-
- if( moduleTree.size() > 1 )
- NestedPublishInfo.getDefault().getServerPublishInfo(server.getServer()).getPublishInfo(newTree,
module).setResources(md.members());
-
-
- IWebModule webModule = (IWebModule)module.loadAdapter(IWebModule.class, monitor);
- IModule[] childModules = webModule.getModules();
- for (int i = 0; i < childModules.length; i++) {
- IModule module2 = childModules[i];
- // if a lib .jar needs to be repacked, repack the whole thing
- if( hasDelta(module2, newTree))
- packModuleIntoJar(module, webModule.getURI(module2), moduleDeployPath);
- }
- }
-
- protected IStatus unpublish(IDeployableServer jbServer, IModule module,
+ protected IStatus unpublish(IDeployableServer jbServer, IModule[] module,
IProgressMonitor monitor) throws CoreException {
-
- IPath root = new Path(jbServer.getDeployDirectory());
- if( module.getModuleType().getId().equals("jst.web")) {
- // copy the module first
- IWebModule webmodule = (IWebModule)module.loadAdapter(IWebModule.class, monitor);
- IPath moduleDeployPath = root.append(webmodule.getContextRoot() + ".war");
- FileUtil.completeDelete(moduleDeployPath.toFile());
- } else if( module.getModuleType().getId().equals("jst.ear")) {
- IPath moduleDeployPath = root.append(module.getProject().getName() +
".ear");
- FileUtil.completeDelete(moduleDeployPath.toFile());
- }
-
+ IPath path = getDeployPath(module);
+ FileUtil.completeDelete(path.toFile());
return new Status(IStatus.OK, JBossServerCorePlugin.PLUGIN_ID,
IStatus.OK, "", null);
}
-
- /*
- *
- * Utility Methods
- *
- *
- */
-
- private boolean hasDelta( IModule module, ArrayList<IModule> moduleTree ) {
- return getDelta(module, moduleTree).length > 0;
- }
-
- public IModuleResourceDelta[] getDelta(IModule module, ArrayList<IModule>
moduleTree) {
- IModuleResourceDelta[] deltas;
- if( moduleTree.size() == 1 ) {
- final IModule[] modules ={module};
- deltas = ((Server)server.getServer()).getPublishedResourceDelta( modules );
- } else {
- deltas =
NestedPublishInfo.getDefault().getServerPublishInfo(server.getServer()).getDelta(moduleTree,
module);
+ protected IPath getDeployPath(IModule[] moduleTree) {
+ IPath root = new Path( server.getDeployDirectory() );
+ String type;
+ for( int i = 0; i < moduleTree.length; i++ ) {
+ type = moduleTree[i].getModuleType().getId();
+ if( "jst.ear".equals(type))
+ root = root.append(moduleTree[i].getProject().getName() + ".ear");
+ else if( "jst.web".equals(type))
+ root = root.append(moduleTree[i].getProject().getName() + ".war");
+ else if( "jst.utility".equals(type) && i >= 1 &&
"jst.web".equals(moduleTree[i-1].getModuleType().getId()))
+ root =
root.append("WEB-INF").append("lib").append(moduleTree[i].getProject().getName()
+ ".jar");
+ else
+ root = root.append(moduleTree[i].getProject().getName() + ".jar");
}
- return deltas;
+ return root;
}
+ protected boolean deployPackaged(IModule[] moduleTree) {
+ if(
moduleTree[moduleTree.length-1].getModuleType().getId().equals("jst.utility"))
return true;
+ return false;
+ }
+ public int getPublishState() {
+ return IServer.PUBLISH_STATE_NONE;
+ }
+
/*
* Just package into a jar raw. Don't think about it, just do it
*/
- protected void packModuleIntoJar(IModule module, String deploymentUnitName, IPath
destination)throws CoreException {
- String dest = destination.append(deploymentUnitName).toString();
+ protected void packModuleIntoJar(IModule module, IPath destination)throws CoreException
{
+ String dest = destination.toString();
ModulePackager packager = null;
try {
packager = new ModulePackager(dest, false);
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/NullPublisher.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/NullPublisher.java 2007-09-24
17:05:07 UTC (rev 3772)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/NullPublisher.java 2007-09-24
17:05:58 UTC (rev 3773)
@@ -40,13 +40,11 @@
}
public IStatus publishModule(int kind, int deltaKind, int modulePublishState,
- IModule module, IProgressMonitor monitor) throws CoreException {
+ IModule[] module, IProgressMonitor monitor) throws CoreException {
return null;
}
public void setDelta(IModuleResourceDelta[] delta) {
- // TODO Auto-generated method stub
-
}
}
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-24
17:05:07 UTC (rev 3772)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/PackagesPublisher.java 2007-09-24
17:05:58 UTC (rev 3773)
@@ -73,16 +73,17 @@
}
public IStatus publishModule(int kind, int deltaKind, int modulePublishState,
- IModule module, IProgressMonitor monitor) throws CoreException {
+ IModule[] module, IProgressMonitor monitor) throws CoreException {
try {
+ IModule module2 = module[0];
// if it's being removed
if( deltaKind == ServerBehaviourDelegate.REMOVED ) {
- removeModule(module, kind, deltaKind, monitor);
+ removeModule(module2, kind, deltaKind, monitor);
return null;
}
if( deltaKind == ServerBehaviourDelegate.ADDED || deltaKind ==
ServerBehaviourDelegate.CHANGED) {
- publishModule(module, kind, deltaKind, modulePublishState, monitor);
+ publishModule(module2, kind, deltaKind, modulePublishState, monitor);
return null;
}
}catch(Exception e) {
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/SingleFilePublisher.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/SingleFilePublisher.java 2007-09-24
17:05:07 UTC (rev 3772)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/SingleFilePublisher.java 2007-09-24
17:05:58 UTC (rev 3773)
@@ -29,18 +29,19 @@
}
public IStatus publishModule(int kind, int deltaKind,
- int modulePublishState, IModule module, IProgressMonitor monitor)
+ int modulePublishState, IModule[] module, IProgressMonitor monitor)
throws CoreException {
+ IModule module2 = module[0];
IStatus status = null;
if(ServerBehaviourDelegate.REMOVED == deltaKind){
- status = unpublish(server, module, kind, deltaKind, modulePublishState,
monitor);
+ status = unpublish(server, module2, kind, deltaKind, modulePublishState,
monitor);
} else if( ServerBehaviourDelegate.NO_CHANGE != deltaKind || kind ==
IServer.PUBLISH_FULL || kind == IServer.PUBLISH_CLEAN ){
// if there's no change, do nothing. Otherwise, on change or add,
re-publish
- status = publish(server, module, kind, deltaKind, modulePublishState, monitor);
+ status = publish(server, module2, kind, deltaKind, modulePublishState,
monitor);
} else if( ServerBehaviourDelegate.NO_CHANGE != deltaKind && kind ==
IServer.PUBLISH_INCREMENTAL ){
- status = publish(server, module, kind, deltaKind, modulePublishState, monitor);
+ status = publish(server, module2, kind, deltaKind, modulePublishState,
monitor);
}
return status;
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-24
17:05:07 UTC (rev 3772)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DeployableServerBehavior.java 2007-09-24
17:05:58 UTC (rev 3773)
@@ -43,14 +43,12 @@
public void setupLaunchConfiguration(ILaunchConfigurationWorkingCopy workingCopy,
IProgressMonitor monitor) throws CoreException {
workingCopy.setAttribute(DeployableLaunchConfiguration.ACTION_KEY,
DeployableLaunchConfiguration.START);
}
-
-
-// public IModuleResourceDelta[] getPublishedResourceDelta(IModule[] module) {
-// return ((Server)getServer()).getPublishedResourceDelta(module);
-// }
-
- private void print(int kind, int deltaKind, String name) {
+ private void print(int kind, int deltaKind, IModule[] module) {
+ String name = "";
+ for( int i = 0; i < module.length; i++ )
+ name += module[i].getName();
+
System.out.print("publishing module (" + name + "): ");
switch( kind ) {
case IServer.PUBLISH_INCREMENTAL: System.out.print("incremental, "); break;
@@ -66,12 +64,21 @@
}
System.out.println(" to server " + getServer().getName() + "(" +
getServer().getId() + ")");
}
+
+ /*
+ * The module is a list of module trail points, from parent to child
+ * Thus:
+ * {ear, war} for the war portion, {ear, ejb} for the ejb portion
+ *
+ * (non-Javadoc)
+ * @see org.eclipse.wst.server.core.model.ServerBehaviourDelegate#publishModule(int,
int, org.eclipse.wst.server.core.IModule[], org.eclipse.core.runtime.IProgressMonitor)
+ */
protected void publishModule(int kind, int deltaKind, IModule[] module, IProgressMonitor
monitor) throws CoreException {
// kind = [incremental, full, auto, clean] = [1,2,3,4]
// delta = [no_change, added, changed, removed] = [0,1,2,3]
if( module.length == 0 ) return;
IJBossServerPublisher publisher;
- print(kind, deltaKind, module[0].getName());
+ print(kind, deltaKind, module);
int modulePublishState = getServer().getModulePublishState(module) + 0;
EventLogTreeItem root = EventLogModel.getModel(getServer()).getRoot();
@@ -79,22 +86,24 @@
root = PublisherEventLogger.createMultipleModuleTopLevelEvent(root, module.length);
}
- for( int i = 0; i < module.length; i++ ) {
+ if( module.length > 0 ) {
+ IModule lastMod = module[module.length -1];
try {
- if( isJstModule(module[i]) ) {
+ if( isJstModule(lastMod) ) {
publisher = new JstPublisher(getServer(), root);
- } else if( isPackagesTypeModule(module[i]) ) {
+ } else if( isPackagesTypeModule(lastMod) ) {
publisher = new PackagesPublisher(getServer(), root);
- } else if( module[i].getModuleType().getId().equals("jboss.singlefile")){
+ } 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[0], monitor);
+ publisher.publishModule(kind, deltaKind, modulePublishState, module, monitor);
setModulePublishState(module, publisher.getPublishState());
+ } catch( Throwable e ) {
+ e.printStackTrace();
}
- catch( Throwable e ) {e.printStackTrace();}
}
}
@@ -104,8 +113,8 @@
// TODO: Change to if it is a flex project. Don't know how to do that yet.
protected boolean isJstModule(IModule mod) {
String type = mod.getModuleType().getId();
- if( type.equals("jst.ejb") || type.equals("jst.client")
- || type.equals("jst.web") || type.equals("jst.ear"))
+ if( type.equals("jst.ejb") || type.equals("jst.web") ||
+ type.equals("jst.ear") || type.equals("jst.utility"))
return true;
return false;
}