Author: rob.stryker(a)jboss.com
Date: 2007-09-11 01:26:57 -0400 (Tue, 11 Sep 2007)
New Revision: 3537
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/modules/
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/modules/ArchivesBuildListener.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/modules/ArchivesModelModuleContributor.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/modules/ModulePackageTypeConverter.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/modules/PackageModuleFactory.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/modules/PackagedArtifactAdapter.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/modules/SingleDeployableFactory.java
Removed:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/ArchivesBuildListener.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/ArchivesModelModuleContributor.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/ModulePackageTypeConverter.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/PackageModuleFactory.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/PackagedArtifactAdapter.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/SingleDeployableFactory.java
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/META-INF/MANIFEST.MF
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/JBossServerCorePlugin.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/types/EarArchiveType.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/DeployableServerBehavior.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml
Log:
Renamed package from as.core.packages to as.core.modules
Moving to a cleaner API which can be opened up logically and more easily extended.
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/META-INF/MANIFEST.MF 2007-09-11
05:25:21 UTC (rev 3536)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/META-INF/MANIFEST.MF 2007-09-11
05:26:57 UTC (rev 3537)
@@ -24,7 +24,7 @@
Export-Package: org.jboss.ide.eclipse.as.core,
org.jboss.ide.eclipse.as.core.extensions.descriptors,
org.jboss.ide.eclipse.as.core.extensions.events,
- org.jboss.ide.eclipse.as.core.packages,
+ org.jboss.ide.eclipse.as.core.modules,
org.jboss.ide.eclipse.as.core.packages.types,
org.jboss.ide.eclipse.as.core.publishers,
org.jboss.ide.eclipse.as.core.runtime,
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/JBossServerCorePlugin.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/JBossServerCorePlugin.java 2007-09-11
05:25:21 UTC (rev 3536)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/JBossServerCorePlugin.java 2007-09-11
05:26:57 UTC (rev 3537)
@@ -29,7 +29,7 @@
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Plugin;
-import org.jboss.ide.eclipse.as.core.packages.ArchivesBuildListener;
+import org.jboss.ide.eclipse.as.core.modules.ArchivesBuildListener;
import org.osgi.framework.BundleContext;
/**
Copied:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/modules/ArchivesBuildListener.java
(from rev 3530,
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/ArchivesBuildListener.java)
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/modules/ArchivesBuildListener.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/modules/ArchivesBuildListener.java 2007-09-11
05:26:57 UTC (rev 3537)
@@ -0,0 +1,199 @@
+/**
+ * JBoss, a Division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+* This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.as.core.modules;
+
+import java.util.ArrayList;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.ServerCore;
+import org.eclipse.wst.server.core.internal.ModuleFactory;
+import org.eclipse.wst.server.core.internal.ServerPlugin;
+import org.eclipse.wst.server.core.model.ServerBehaviourDelegate;
+import org.jboss.ide.eclipse.archives.core.model.ArchivesModel;
+import org.jboss.ide.eclipse.archives.core.model.IArchive;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveFileSet;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveNodeDelta;
+import org.jboss.ide.eclipse.archives.core.model.other.IArchiveBuildListener;
+import org.jboss.ide.eclipse.archives.core.model.other.IArchiveModelListener;
+import org.jboss.ide.eclipse.archives.core.util.ModelUtil;
+import
org.jboss.ide.eclipse.as.core.modules.PackageModuleFactory.PackagedModuleDelegate;
+import org.jboss.ide.eclipse.as.core.server.DeployableServerBehavior;
+import org.jboss.ide.eclipse.as.core.server.attributes.IDeployableServer;
+import org.jboss.ide.eclipse.as.core.util.FileUtil;
+
+/**
+ *
+ * @author rob.stryker(a)jboss.com
+ */
+public class ArchivesBuildListener implements IArchiveBuildListener,
IArchiveModelListener {
+
+ public static ArchivesBuildListener instance;
+ public static final String DEPLOY_SERVERS =
"org.jboss.ide.eclipse.as.core.model.PackagesListener.DeployServers";
+ public static final String DEPLOY_AFTER_BUILD =
"org.jboss.ide.eclipse.as.core.model.PackagesListener.DeployAfterBuild";
+
+ public static ArchivesBuildListener getInstance() {
+ if( instance == null ) {
+ instance = new ArchivesBuildListener();
+ }
+ return instance;
+ }
+
+ public ArchivesBuildListener() {
+ ArchivesModel.instance().addBuildListener(this);
+ ArchivesModel.instance().addModelListener(this, ArchivesModel.LIST_FRONT);
+ }
+
+ public void cleanArchive(IArchive pkg) {
+ }
+
+
+ public void finishedBuildingArchive(IArchive pkg) {
+ if( pkg.isTopLevel() && new
Boolean(pkg.getProperty(DEPLOY_AFTER_BUILD)).booleanValue()) {
+ publish(pkg);
+ }
+ }
+
+ public void fileRemoved(IArchive topLevelPackage, IArchiveFileSet fileset, IPath
filePath) {
+ }
+ public void fileUpdated(IArchive topLevelPackage, IArchiveFileSet fileset, IPath
filePath) {
+ }
+
+ // If we're supposed to auto-deploy, get on it
+ protected static void publish(IArchive pkg) {
+ String servers = pkg.getProperty(ArchivesBuildListener.DEPLOY_SERVERS);
+ publish(pkg, servers, IServer.PUBLISH_INCREMENTAL);
+ }
+ public static void publish(IArchive pkg, String servers, int publishType) {
+ IModule[] module = getModule(pkg);
+ if( module[0] == null ) return;
+ DeployableServerBehavior[] serverBehaviors =
ArchivesBuildListener.getServers(servers);
+ if( serverBehaviors != null ) {
+ for( int i = 0; i < serverBehaviors.length; i++ ) {
+ serverBehaviors[i].publishOneModule(publishType, module,
ServerBehaviourDelegate.CHANGED, new NullProgressMonitor());
+ }
+ }
+ }
+ protected static IModule[] getModule(IArchive node) {
+ ModuleFactory factory =
ServerPlugin.findModuleFactory("org.jboss.ide.eclipse.as.core.PackageModuleFactory");
+ IModule mod = factory.findModule(PackageModuleFactory.getID(node), new
NullProgressMonitor());
+ return new IModule[] { mod };
+ }
+ protected static PackagedModuleDelegate getModuleDelegate(IArchive node) {
+ IModule mod = getModule(node)[0];
+ return (PackagedModuleDelegate)mod.loadAdapter(PackagedModuleDelegate.class, new
NullProgressMonitor());
+ }
+
+ protected IDeployableServer getDeployableServerFromBehavior(DeployableServerBehavior
dsb) {
+ IServer server = dsb.getServer();
+ IDeployableServer ids = (IDeployableServer)server.loadAdapter(IDeployableServer.class,
new NullProgressMonitor());
+ return ids;
+ }
+
+ public static DeployableServerBehavior[] getServers(String servers) {
+ if( servers == null || "".equals(servers))
+ return null;
+ ArrayList list = new ArrayList();
+ String[] byId = servers.split(",");
+ for( int i = 0; i < byId.length; i++ ) {
+ IServer server = ServerCore.findServer(byId[i]);
+ if( server != null ) {
+ Object o = server.loadAdapter(DeployableServerBehavior.class, new
NullProgressMonitor());
+ if( o != null ) {
+ list.add((DeployableServerBehavior)o);
+ }
+ }
+ }
+ return (DeployableServerBehavior[]) list.toArray(new
DeployableServerBehavior[list.size()]);
+ }
+
+ /*
+ * If a node is changing from exploded to imploded, or vice versa
+ * make sure to delete the pre-existing file or folder on the server.
+ */
+ public void packageBuildTypeChanged(IArchive topLevelPackage, boolean isExploded) {
+ String servers = topLevelPackage.getProperty(ArchivesBuildListener.DEPLOY_SERVERS);
+ DeployableServerBehavior[] serverBehaviors =
ArchivesBuildListener.getServers(servers);
+ if( serverBehaviors != null ) {
+ IPath sourcePath, destPath;
+ IDeployableServer depServer;
+ for( int i = 0; i < serverBehaviors.length; i++ ) {
+ sourcePath = topLevelPackage.getArchiveFilePath();
+ depServer = getDeployableServerFromBehavior(serverBehaviors[i]);
+ destPath = new
Path(depServer.getDeployDirectory()).append(sourcePath.lastSegment());
+ FileUtil.safeDelete(destPath.toFile());
+ FileUtil.fileSafeCopy(sourcePath.toFile(), destPath.toFile());
+ }
+ }
+ }
+
+ public void buildFailed(IArchive pkg, IStatus status) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void finishedBuild(IPath project) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void finishedCollectingFileSet(IArchiveFileSet fileset) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void startedBuild(IPath project) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void startedBuildingArchive(IArchive pkg) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void startedCollectingFileSet(IArchiveFileSet fileset) {
+ // TODO Auto-generated method stub
+ }
+ public void startedBuildingPackage(IArchive pkg) {
+ // TODO Auto-generated method stub
+ }
+
+ public void cleanProject(IPath project) {
+ }
+
+ public void modelChanged(IArchiveNodeDelta delta) {
+ IPath p ;
+ if( delta.getPreNode() == null )
+ p = delta.getPostNode().getProjectPath();
+ else
+ p = delta.getPreNode().getProjectPath();
+
+ ArchivesModelModuleContributor.getInstance().refreshProject(p);
+ }
+
+
+}
Copied:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/modules/ArchivesModelModuleContributor.java
(from rev 3530,
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/ArchivesModelModuleContributor.java)
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/modules/ArchivesModelModuleContributor.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/modules/ArchivesModelModuleContributor.java 2007-09-11
05:26:57 UTC (rev 3537)
@@ -0,0 +1,130 @@
+package org.jboss.ide.eclipse.as.core.modules;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.wst.server.core.IModule;
+import org.jboss.ide.eclipse.archives.core.model.ArchivesModel;
+import org.jboss.ide.eclipse.archives.core.model.ArchivesModelCore;
+import org.jboss.ide.eclipse.archives.core.model.IArchive;
+import org.jboss.ide.eclipse.as.core.modules.PackageModuleFactory.IModuleContributor;
+import
org.jboss.ide.eclipse.as.core.modules.PackageModuleFactory.PackagedModuleDelegate;
+
+public class ArchivesModelModuleContributor implements IModuleContributor {
+
+ private static ArchivesModelModuleContributor instance;
+ public static ArchivesModelModuleContributor getInstance() {
+ if( instance == null ) {
+ instance = new ArchivesModelModuleContributor(PackageModuleFactory.getFactory());
+ }
+ return instance;
+ }
+
+ private PackageModuleFactory factory;
+ protected ArrayList modules = null;
+ protected HashMap projectToModules = new HashMap(5); //IPath to IModule
+ protected HashMap moduleDelegates = new HashMap(5);
+ protected HashMap packageToModule = new HashMap(5);
+
+ private ArchivesModelModuleContributor(PackageModuleFactory factory) {
+ this.factory = factory;
+ }
+
+ public IModule[] getModules() {
+ if( modules == null ) {
+ modules = new ArrayList();
+ IProject[] projects2 = ResourcesPlugin.getWorkspace().getRoot().getProjects();
+ int size = projects2.length;
+ for (int i = 0; i < size; i++) {
+ if (projects2[i].isAccessible()) {
+ createModules(projects2[i]);
+ }
+ }
+ }
+ return (IModule[]) modules.toArray(new IModule[modules.size()]);
+ }
+
+ protected void createModules(IProject project) {
+ IArchive[] packs = ArchivesModelCore.getProjectPackages(project.getLocation(), null,
false);
+ if( packs != null && packs.length > 0 ) {
+ IModule module;
+ IArchive[] packages = ArchivesModelCore.getProjectPackages(project.getLocation(), new
NullProgressMonitor(), true);
+ boolean requiresSave = ensureArchivesHaveIDs(project, packages);
+ ArrayList mods = new ArrayList();
+ for( int i = 0; i < packages.length; i++ ) {
+ module = factory.createModule2(packages[i], project);
+ modules.add(module);
+ Object moduleDelegate = new PackagedModuleDelegate(packages[i]);
+ packageToModule.put(packages[i], module);
+ moduleDelegates.put(module, moduleDelegate);
+ mods.add(module);
+ }
+ projectToModules.put(project.getLocation(), mods);
+ }
+ }
+
+ public boolean containsModule(IModule module) {
+ return moduleDelegates.containsKey(module);
+ }
+
+ public PackagedModuleDelegate getModuleDelegate(IModule module) {
+ return (PackagedModuleDelegate)moduleDelegates.get(module);
+ }
+
+ public void refreshProject(IPath projectLoc) {
+ // remove old mods
+ ArrayList mods = (ArrayList)projectToModules.get(projectLoc);
+ IModule mod;
+ IArchive arc;
+ if (mods != null) {
+ for( Iterator i = mods.iterator(); i.hasNext();) {
+ mod = (IModule)i.next();
+ if( moduleDelegates.get(mod) != null ) {
+ arc = ((PackagedModuleDelegate)moduleDelegates.get(mod)).getPackage();
+ packageToModule.remove(arc);
+ moduleDelegates.remove(mod);
+ }
+ }
+ }
+ createModules(findProject(projectLoc));
+ factory.clearModuleCache();
+ }
+
+ protected IProject findProject(IPath projectLoc) {
+ IProject proj = null;
+ IProject[] projects2 = ResourcesPlugin.getWorkspace().getRoot().getProjects();
+ int size = projects2.length;
+ for (int i = 0; i < size; i++) {
+ if( projects2[i].getLocation().equals(projectLoc))
+ proj = projects2[i];
+ }
+ return proj;
+ }
+
+ /**
+ * Set a property so that each module that's here in the factory
+ * has a unique ID other than it's name (which is not unique)
+ * @param archives
+ * @return returns whether a save has occurred
+ */
+ protected boolean ensureArchivesHaveIDs(IProject project, IArchive[] archives) {
+ boolean requiresSave = false;
+ for( int i = 0; i < archives.length; i++ ) {
+ if( PackageModuleFactory.getID(archives[i]) == null ) {
+ requiresSave = true;
+ archives[i].setProperty(PackageModuleFactory.MODULE_ID_PROPERTY_KEY,
+ PackageModuleFactory.getID(archives[i], true));
+ }
+ }
+ if( requiresSave ) {
+ // save
+ ArchivesModel.instance().saveModel(project.getLocation(), new NullProgressMonitor());
+ }
+ return requiresSave;
+ }
+}
Copied:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/modules/ModulePackageTypeConverter.java
(from rev 3530,
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/ModulePackageTypeConverter.java)
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/modules/ModulePackageTypeConverter.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/modules/ModulePackageTypeConverter.java 2007-09-11
05:26:57 UTC (rev 3537)
@@ -0,0 +1,48 @@
+/**
+ * JBoss, a Division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+* This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.as.core.modules;
+
+import org.eclipse.wst.server.core.IModule;
+import org.jboss.ide.eclipse.archives.core.ArchivesCore;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveType;
+import org.jboss.ide.eclipse.as.core.packages.types.EarArchiveType;
+import org.jboss.ide.eclipse.as.core.packages.types.EjbArchiveType;
+import org.jboss.ide.eclipse.as.core.packages.types.WarArchiveType;
+
+/**
+ *
+ * @author rob.stryker(a)jboss.com
+ */
+public class ModulePackageTypeConverter {
+ public static IArchiveType getPackageTypeFor(IModule module) {
+ String modType = module.getModuleType().getId();
+ if("jst.web".equals(modType)) {
+ return
ArchivesCore.getInstance().getExtensionManager().getArchiveType(WarArchiveType.WAR_PACKAGE_TYPE);
+ } else if("jst.ear".equals(modType)) {
+ return
ArchivesCore.getInstance().getExtensionManager().getArchiveType(EarArchiveType.ID);
+ } else if("jst.ejb".equals(modType)) {
+ return
ArchivesCore.getInstance().getExtensionManager().getArchiveType(EjbArchiveType.ID);
+ }
+
+ return null;
+ }
+}
Copied:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/modules/PackageModuleFactory.java
(from rev 3530,
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/PackageModuleFactory.java)
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/modules/PackageModuleFactory.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/modules/PackageModuleFactory.java 2007-09-11
05:26:57 UTC (rev 3537)
@@ -0,0 +1,437 @@
+/**
+ * JBoss, a Division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+* This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.as.core.modules;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.internal.ModuleFactory;
+import org.eclipse.wst.server.core.internal.ModuleFile;
+import org.eclipse.wst.server.core.internal.ServerPlugin;
+import org.eclipse.wst.server.core.model.IModuleFile;
+import org.eclipse.wst.server.core.model.IModuleFolder;
+import org.eclipse.wst.server.core.model.IModuleResource;
+import org.eclipse.wst.server.core.model.ModuleDelegate;
+import org.eclipse.wst.server.core.model.ModuleFactoryDelegate;
+import org.jboss.ide.eclipse.archives.core.model.IArchive;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveFileSet;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveFolder;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveNode;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveNodeVisitor;
+import org.jboss.ide.eclipse.archives.core.util.ModelUtil;
+import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
+import org.osgi.service.prefs.BackingStoreException;
+
+/**
+ *
+ * @author rob.stryker(a)jboss.com
+ */
+public class PackageModuleFactory extends ModuleFactoryDelegate {
+
+ private static int nextArchiveId = -1;
+ private static final String NEXT_ARCHIVE_KEY =
"org.jboss.ide.eclipse.as.core.PackageModuleFactory.nextId";
+
+ public static final String FACTORY_TYPE_ID =
"org.jboss.ide.eclipse.as.core.PackageModuleFactory";
+ public static final String MODULE_TYPE = "jboss.package";
+ public static final String VERSION = "1.0";
+
+ public static final String MODULE_ID_PROPERTY_KEY =
"org.jboss.ide.eclipse.as.core.packages.ModuleIDPropertyKey";
+
+ // the factory delegate and the factory respectively
+ private static PackageModuleFactory factDelegate;
+ private static ModuleFactory factory;
+
+ /**
+ * Find the module factory wrapper WTP provides for us
+ * @return
+ */
+ public static PackageModuleFactory getFactory() {
+ if( factDelegate == null ) {
+ ModuleFactory[] factories = ServerPlugin.getModuleFactories();
+
+ for( int i = 0; i < factories.length; i++ ) {
+ if( factories[i].getId().equals(PackageModuleFactory.FACTORY_TYPE_ID)) {
+ Object o = factories[i].getDelegate(new NullProgressMonitor());
+ if( o instanceof PackageModuleFactory ) {
+ factory = factories[i];
+ factDelegate = (PackageModuleFactory)o;
+ return factDelegate;
+ }
+ }
+ }
+ }
+ return factDelegate;
+ }
+
+ /**
+ * Get the module ID of this IArchive if it exists.
+ * Do not create a new one otherwise
+ * @param pack
+ * @return
+ */
+ public static String getID(IArchive pack) {
+ return getID(pack, false);
+ }
+
+ /**
+ * Get the module ID of this IArchive if it exists.
+ * If create is true, and the ID is not set, set a default ID.
+ * @param pack
+ * @param create
+ * @return
+ */
+ protected static String getID(IArchive pack, boolean create) {
+ String propVal = pack.getProperty(MODULE_ID_PROPERTY_KEY);
+ if( propVal == null && create ) {
+ if( nextArchiveId == -1 ) {
+ nextArchiveId =
+ new
InstanceScope().getNode(JBossServerCorePlugin.PLUGIN_ID).getInt(NEXT_ARCHIVE_KEY, 0);
+ }
+ nextArchiveId++;
+ IEclipsePreferences prefs = new
InstanceScope().getNode(JBossServerCorePlugin.PLUGIN_ID);
+ prefs.putInt(NEXT_ARCHIVE_KEY, nextArchiveId);
+ try {
+ prefs.flush();
+ } catch( BackingStoreException bse ) {
+ }
+ return "" + nextArchiveId;
+ } else if( propVal == null ) {
+ return null;
+ }
+ return propVal;
+ }
+
+ /**
+ * Return the name of the project in the workspace
+ * @param node
+ * @return
+ */
+ public static String getProjectName(IArchiveNode node) {
+ IPath projPath = node.getProjectPath();
+ if( projPath == null ) return null;
+ IProject[] list = ResourcesPlugin.getWorkspace().getRoot().getProjects();
+ for( int i = 0; i < list.length; i++ )
+ if( list[i].getLocation().equals(projPath))
+ return list[i].getName();
+ return null;
+ }
+
+ /**
+ * Get the visible name of this module
+ * @param pack
+ * @return
+ */
+ public static String getName(IArchive pack) {
+ return getProjectName(pack) + "/" + pack.getName();
+ }
+
+
+
+ protected IModuleContributor[] moduleContributors;
+ public PackageModuleFactory() {
+ super();
+ moduleContributors = new IModuleContributor[] {
ArchivesModelModuleContributor.getInstance() };
+
+ }
+
+ protected IModule createModule2(IArchive pack, IProject project) {
+ return createModule(getID(pack), getName(pack), MODULE_TYPE, VERSION, project);
+ }
+
+
+ public IModule[] getModules() {
+ ArrayList list = new ArrayList();
+ for( int i = 0; i < moduleContributors.length; i++ ) {
+ list.addAll(Arrays.asList(moduleContributors[i].getModules()));
+ }
+ return (IModule[]) list.toArray(new IModule[list.size()]);
+ }
+
+ public ModuleDelegate getModuleDelegate(IModule module) {
+ for( int i = 0; i < moduleContributors.length; i++ ) {
+ if( moduleContributors[i].containsModule(module))
+ return moduleContributors[i].getModuleDelegate(module);
+ }
+ return null;
+ }
+
+ public static interface IModuleContributor {
+ public IModule[] getModules();
+ public boolean containsModule(IModule module);
+ public PackagedModuleDelegate getModuleDelegate(IModule module);
+ }
+
+ public static interface IExtendedModuleResource extends IModuleResource {
+ public IPath getSourcePath();
+ public IArchiveNode getNode();
+ public IPath getDeepDestination();
+ public IPath getConcreteDestFile();
+ }
+
+ public static class DelegateInitVisitor implements IArchiveNodeVisitor {
+
+ private IArchive pack;
+ private HashMap members; // node -> imoduleresource
+ private HashMap pathToNode; // path -> node
+ public DelegateInitVisitor(IArchive pack) {
+ this.pack = pack;
+ reset();
+ }
+ public void reset() {
+ members = new HashMap();
+ pathToNode = new HashMap();
+ }
+ public boolean visit(IArchiveNode node) {
+ int type = node.getNodeType();
+ if( type == IArchiveNode.TYPE_ARCHIVE && ((IArchive)node).isTopLevel()) {
+ IPath rel = ((IArchive)node).getRootArchiveRelativePath();
+ members.put(node, new ArchiveContainerResource(((IArchive)node).getName(), node,
rel));
+ pathToNode.put(rel, node);
+ } else if( type == IArchiveNode.TYPE_ARCHIVE || type ==
IArchiveNode.TYPE_ARCHIVE_FOLDER) {
+ String name = type == IArchiveNode.TYPE_ARCHIVE ? ((IArchive)node).getName() :
((IArchiveFolder)node).getName();
+ // if we're any other archive or a folder, create us and add to parent
+ IArchiveNode parent = node.getParent();
+ ArchiveContainerResource parentAsResource =
(ArchiveContainerResource)members.get(parent);
+ IPath rel = node.getRootArchiveRelativePath();
+ members.put(node, new ArchiveContainerResource(name, node, rel));
+ pathToNode.put(rel, node);
+ parentAsResource.addChild((IModuleResource)members.get(node));
+ } else if( type == IArchiveNode.TYPE_ARCHIVE_FILESET ) {
+ ArchiveContainerResource parentAsResource =
(ArchiveContainerResource)members.get(node.getParent());
+ parentAsResource.addFilesetAsChild((IArchiveFileSet)node);
+ }
+
+ return true;
+ }
+
+ public IModuleResource getRootResource() {
+ return (IModuleResource)members.get(pack);
+ }
+
+ public IModuleResource getResourceForNode(IArchiveNode node) {
+ return (IModuleResource)members.get(node);
+ }
+ }
+
+ public static class ArchiveContainerResource implements IModuleFolder,
IExtendedModuleResource {
+
+ protected IPath moduleRelativePath;
+ protected IArchiveNode node;
+ protected String name;
+ private HashMap members;
+
+ // represents source folder on disk. only used if node is fileset
+ private IPath folderGlobalPath = null;
+ public ArchiveContainerResource(String name,IArchiveNode node,IPath moduleRelativePath
) {
+ this.name = name;
+ this.node = node;
+ this.moduleRelativePath = moduleRelativePath;
+ members = new HashMap();
+ if( node instanceof IArchiveFileSet) {
+ IPath tmp =
moduleRelativePath.removeFirstSegments(node.getParent().getRootArchiveRelativePath().segmentCount());
+ folderGlobalPath = ((IArchiveFileSet)node).getGlobalSourcePath().append(tmp);
+ }
+ }
+
+ public int hashCode() {
+ return name.hashCode() * 37 + moduleRelativePath.hashCode();
+ }
+
+ public boolean equals(Object other) {
+ if (other instanceof IModuleFolder) {
+ IModuleFolder resource = (IModuleFolder) other;
+ return resource.getModuleRelativePath().equals(getModuleRelativePath());
+ }
+ return false;
+ }
+
+ public void addChild(IModuleResource resource) {
+ members.put(resource.getModuleRelativePath(), resource);
+ }
+
+ public void removeChild(IPath moduleRelativePath) {
+ members.remove(moduleRelativePath);
+ }
+ public IModuleResource getChild(IPath path) {
+ return (IModuleResource)members.get(path);
+ }
+
+ public void addFilesetAsChild(IArchiveFileSet fs) {
+ IPath[] paths = fs.findMatchingPaths(); // file-system based source paths
+ IPath globalSource = fs.getGlobalSourcePath();
+ for( int i = 0; i < paths.length; i++ ) {
+ addFilesetPathAsChild(fs, globalSource, paths[i]);
+ }
+ }
+
+ public void addFilesetPathAsChild(IArchiveFileSet fs, IPath globalSource, IPath path)
{
+ IPath archiveRelative = fs.getRootArchiveRelativePath(path);
+ IPath fsRelative = path.removeFirstSegments(globalSource.segmentCount());
+ ArchiveContainerResource parent = find(fs, globalSource,
fsRelative.removeLastSegments(1), true);
+ ExtendedModuleFile emf = new ExtendedModuleFile(archiveRelative.lastSegment(),
archiveRelative, path.toFile().lastModified(), path, fs);
+ parent.addChild(emf);
+ }
+
+ public void removeFilesetPathAsChild(IArchiveFileSet fs, IPath path) {
+ IPath globalSource = fs.getGlobalSourcePath();
+ IPath fsRelative = path.removeFirstSegments(globalSource.segmentCount());
+ ArchiveContainerResource parent = find(fs, globalSource,
fsRelative.removeLastSegments(1), false);
+ if( parent != null )
+ parent.removeFilesetPathAsChild(fs, path);
+ }
+
+ protected ArchiveContainerResource find(IArchiveFileSet fs, IPath globalSource, IPath
fsRelative, boolean create) {
+ ArchiveContainerResource resource = this;
+ ArchiveContainerResource tmpResource;
+ IPath tmpPath = fs.getRootArchiveRelativePath();
+ int count = fsRelative.segmentCount();
+ for( int i = 0; i < count; i++ ) {
+ tmpPath = tmpPath.append(fsRelative.segment(i));
+ tmpResource = (ArchiveContainerResource)resource.getChild(tmpPath);
+ if( tmpResource == null ) {
+ if( !create )
+ return null;
+ tmpResource = new ArchiveContainerResource(tmpPath.lastSegment(), fs, tmpPath);
+ resource.addChild(tmpResource);
+ }
+ resource = tmpResource;
+ }
+ return resource;
+ }
+
+ public IModuleResource[] members() {
+ Collection c = members.values();
+ return (IModuleResource[]) c.toArray(new IModuleResource[c.size()]);
+ }
+
+ public IPath getModuleRelativePath() {
+ return moduleRelativePath;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public Object getAdapter(Class adapter) {
+ return null;
+ }
+
+ public IPath getDeepDestination() {
+ IPath tmp = node.getNodeType() == IArchiveNode.TYPE_ARCHIVE_FILESET ?
+ ((IArchiveFileSet)node).getRootArchiveRelativePath(folderGlobalPath) :
node.getRootArchiveRelativePath();
+ return node.getRootArchive().getGlobalDestinationPath().append(tmp);
+ }
+ public IPath getConcreteDestFile() {
+ return ModelUtil.getBaseDestinationFile(node,folderGlobalPath);
+ }
+ public IArchiveNode getNode() {
+ return node;
+ }
+
+ public IPath getSourcePath() {
+ return null;
+ }
+
+ }
+
+ public static class ExtendedModuleFile extends ModuleFile implements
IExtendedModuleResource {
+ private IPath srcPath;
+ private IArchiveFileSet node;
+ public ExtendedModuleFile(String name, IPath relativePath, long stamp,
+ IPath srcPath, IArchiveFileSet fs) {
+ super(name, relativePath, stamp);
+ this.srcPath = srcPath;
+ this.node = fs;
+ }
+ public int hashCode() {
+ return name.hashCode() * 37 + path.hashCode();
+ }
+
+ public IPath getPath() { return srcPath; }
+ public IArchiveNode getNode() { return node; }
+ public IPath getDeepDestination() {
+ return
node.getRootArchive().getGlobalDestinationPath().append(node.getRootArchiveRelativePath(path));
+ }
+ public IPath getSourcePath() {
+ return this.srcPath;
+ }
+
+ public IPath getConcreteDestFile() {
+ return ModelUtil.getBaseDestinationFile(node, srcPath);
+ }
+
+ public boolean equals(Object other) {
+ if (other instanceof IModuleFile) {
+ IModuleFile resource = (IModuleFile) other;
+ return resource.getModuleRelativePath().equals(getModuleRelativePath());
+ }
+ return false;
+ }
+
+ }
+
+ public static class PackagedModuleDelegate extends ModuleDelegate {
+ private IArchive pack;
+ private IModuleResource rootResource;
+ private DelegateInitVisitor initVisitor;
+ public PackagedModuleDelegate(IArchive pack) {
+ this.pack = pack;
+ initVisitor = new DelegateInitVisitor(pack);
+ }
+
+ public IArchive getPackage() {
+ return pack;
+ }
+ public IModule[] getChildModules() {
+ return new IModule[0];
+ }
+
+ protected void init() {
+ initVisitor.reset();
+ pack.accept(initVisitor);
+ rootResource = initVisitor.getRootResource();
+ }
+
+ public IModuleResource[] members() throws CoreException {
+ init();
+ return new IModuleResource[] { rootResource };
+ }
+
+ public IStatus validate() {
+ return new Status(IStatus.OK, JBossServerCorePlugin.PLUGIN_ID,
+ 0, "", null);
+ }
+ }
+
+}
Copied:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/modules/PackagedArtifactAdapter.java
(from rev 3530,
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/PackagedArtifactAdapter.java)
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/modules/PackagedArtifactAdapter.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/modules/PackagedArtifactAdapter.java 2007-09-11
05:26:57 UTC (rev 3537)
@@ -0,0 +1,56 @@
+package org.jboss.ide.eclipse.as.core.modules;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IModuleArtifact;
+import org.eclipse.wst.server.core.model.ModuleArtifactAdapterDelegate;
+
+public class PackagedArtifactAdapter extends ModuleArtifactAdapterDelegate {
+
+ public PackagedArtifactAdapter() {
+ }
+
+ public IModuleArtifact getModuleArtifact(Object obj) {
+ if( obj instanceof IJavaProject ) {
+ IProject[] projects2 = ResourcesPlugin.getWorkspace().getRoot().getProjects();
+ boolean done = false;
+ String jpName = ((IJavaProject)obj).getElementName();
+ for( int i = 0; i < projects2.length && !done; i++ ) {
+ if( projects2[i].getName().equals(jpName)) {
+ done = true;
+ obj = projects2[i];
+ break;
+ }
+ }
+ }
+
+ if( obj instanceof IProject ) {
+ PackageModuleFactory factory = PackageModuleFactory.getFactory();
+ if( factory != null ) {
+// IModule[] mods = factory.getModulesFromProject((IProject)obj);
+// if( mods != null && mods.length != 0) {
+// return getArtifact(mods);
+// }
+ }
+ }
+ return null;
+ }
+
+ protected IModuleArtifact getArtifact(IModule[] mod) {
+ //return new PackagedArtifact(mod);
+ // TODO Blocking on eclipse bug 174372
+ return null;
+ }
+
+ public class PackagedArtifact implements IModuleArtifact{
+ protected IModule mod;
+ public PackagedArtifact(IModule module) {
+ this.mod = module;
+ }
+ public IModule getModule() {
+ return mod;
+ }
+ }
+}
Copied:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/modules/SingleDeployableFactory.java
(from rev 3533,
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/SingleDeployableFactory.java)
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/modules/SingleDeployableFactory.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/modules/SingleDeployableFactory.java 2007-09-11
05:26:57 UTC (rev 3537)
@@ -0,0 +1,156 @@
+package org.jboss.ide.eclipse.as.core.modules;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.internal.ModuleFactory;
+import org.eclipse.wst.server.core.internal.ModuleFile;
+import org.eclipse.wst.server.core.internal.ServerPlugin;
+import org.eclipse.wst.server.core.model.IModuleResource;
+import org.eclipse.wst.server.core.model.ModuleDelegate;
+import org.eclipse.wst.server.core.model.ModuleFactoryDelegate;
+import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
+
+public class SingleDeployableFactory extends ModuleFactoryDelegate {
+ public static final String FACTORY_ID =
"org.jboss.ide.eclipse.as.core.singledeployablefactory";
+ private static SingleDeployableFactory factDelegate;
+ public static final String MODULE_TYPE = "jboss.singlefile";
+ public static final String VERSION = "1.0";
+ private static final String PREFERENCE_KEY =
"org.jboss.ide.eclipse.as.core.singledeployable.deployableList";
+ private static final String DELIM = "\r";
+
+
+ private static ModuleFactory factory;
+ public static SingleDeployableFactory getFactory() {
+ if( factDelegate == null ) {
+ ModuleFactory[] factories = ServerPlugin.getModuleFactories();
+ for( int i = 0; i < factories.length; i++ ) {
+ if( factories[i].getId().equals(FACTORY_ID)) {
+ Object o = factories[i].getDelegate(new NullProgressMonitor());
+ if( o instanceof SingleDeployableFactory ) {
+ factory = factories[i];
+ factDelegate = (SingleDeployableFactory)o;
+ return factDelegate;
+ }
+ }
+ }
+ }
+ return factDelegate;
+ }
+
+ public static boolean makeDeployable(IResource resource) {
+ return makeDeployable(resource.getFullPath());
+ }
+
+ public static boolean makeDeployable(IPath workspaceRelative) {
+ boolean ret = getFactory().addModule(workspaceRelative);
+ getFactory().saveDeployableList();
+ return ret;
+ }
+
+ public static void unmakeDeployable(IResource resource) {
+ unmakeDeployable(resource.getFullPath());
+ }
+
+ public static void unmakeDeployable(IPath workspaceRelative) {
+ getFactory().removeModule(workspaceRelative);
+ getFactory().saveDeployableList();
+ }
+
+ public static IModule findModule(IResource resource) {
+ return findModule(resource.getFullPath());
+ }
+ public static IModule findModule(IPath workspaceRelative) {
+ return getFactory().getModule(workspaceRelative);
+ }
+
+
+
+ private HashMap moduleIdToModule;
+ private HashMap moduleToDelegate;
+ public SingleDeployableFactory() {
+ moduleIdToModule = new HashMap();
+ moduleToDelegate = new HashMap();
+ String files =
JBossServerCorePlugin.getDefault().getPluginPreferences().getString(PREFERENCE_KEY);
+ if( files.equals("")) return;
+ String[] files2 = files.split(DELIM);
+ for( int i = 0; i < files2.length; i++ ) {
+ addModule(new Path(files2[i]));
+ }
+ }
+
+ public IModule getModule(IPath path) {
+ return (IModule)moduleIdToModule.get(path);
+ }
+ public void saveDeployableList() {
+ Iterator i = moduleIdToModule.keySet().iterator();
+ String val = "";
+ while(i.hasNext()) {
+ val += ((IPath)i.next()).toString() + DELIM;
+ }
+ JBossServerCorePlugin.getDefault().getPluginPreferences().setValue(PREFERENCE_KEY,
val);
+ JBossServerCorePlugin.getDefault().savePluginPreferences();
+ }
+
+ protected boolean addModule(IPath path) {
+ IResource resource = ResourcesPlugin.getWorkspace().getRoot().findMember(path);
+ if( resource != null && resource.exists() ) {
+ IModule module = createModule(path.toString(), path.toString(), MODULE_TYPE, VERSION,
resource.getProject());
+ moduleIdToModule.put(path, module);
+ moduleToDelegate.put(module, new SingleDeployableModuleDelegate(path));
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ protected void removeModule(IPath path) {
+ IModule mod = (IModule)moduleIdToModule.get(path);
+ moduleIdToModule.remove(path);
+ moduleToDelegate.remove(mod);
+ }
+
+ public IModule[] getModules() {
+ Collection c = moduleIdToModule.values();
+ return (IModule[]) c.toArray(new IModule[c.size()]);
+ }
+
+ public ModuleDelegate getModuleDelegate(IModule module) {
+ return (ModuleDelegate)moduleToDelegate.get(module);
+ }
+
+ public class SingleDeployableModuleDelegate extends ModuleDelegate {
+ private IPath global;
+ public SingleDeployableModuleDelegate(IPath workspaceRelative) {
+ global =
ResourcesPlugin.getWorkspace().getRoot().getLocation().append(workspaceRelative);
+ }
+ public IModule[] getChildModules() {
+ return new IModule[0];
+ }
+
+ public IModuleResource[] members() throws CoreException {
+ return new IModuleResource[] {
+ new ModuleFile(global.lastSegment(),
+ new Path(global.lastSegment()),
+ global.toFile().lastModified()) };
+ }
+
+ public IStatus validate() {
+ return Status.OK_STATUS;
+ }
+
+ public IPath getGlobalSourcePath() {
+ return this.global;
+ }
+ }
+}
Deleted:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/ArchivesBuildListener.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/ArchivesBuildListener.java 2007-09-11
05:25:21 UTC (rev 3536)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/ArchivesBuildListener.java 2007-09-11
05:26:57 UTC (rev 3537)
@@ -1,199 +0,0 @@
-/**
- * JBoss, a Division of Red Hat
- * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
-* This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ide.eclipse.as.core.packages;
-
-import java.util.ArrayList;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.wst.server.core.IModule;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.ServerCore;
-import org.eclipse.wst.server.core.internal.ModuleFactory;
-import org.eclipse.wst.server.core.internal.ServerPlugin;
-import org.eclipse.wst.server.core.model.ServerBehaviourDelegate;
-import org.jboss.ide.eclipse.archives.core.model.ArchivesModel;
-import org.jboss.ide.eclipse.archives.core.model.IArchive;
-import org.jboss.ide.eclipse.archives.core.model.IArchiveFileSet;
-import org.jboss.ide.eclipse.archives.core.model.IArchiveNodeDelta;
-import org.jboss.ide.eclipse.archives.core.model.other.IArchiveBuildListener;
-import org.jboss.ide.eclipse.archives.core.model.other.IArchiveModelListener;
-import org.jboss.ide.eclipse.archives.core.util.ModelUtil;
-import
org.jboss.ide.eclipse.as.core.packages.PackageModuleFactory.PackagedModuleDelegate;
-import org.jboss.ide.eclipse.as.core.server.DeployableServerBehavior;
-import org.jboss.ide.eclipse.as.core.server.attributes.IDeployableServer;
-import org.jboss.ide.eclipse.as.core.util.FileUtil;
-
-/**
- *
- * @author rob.stryker(a)jboss.com
- */
-public class ArchivesBuildListener implements IArchiveBuildListener,
IArchiveModelListener {
-
- public static ArchivesBuildListener instance;
- public static final String DEPLOY_SERVERS =
"org.jboss.ide.eclipse.as.core.model.PackagesListener.DeployServers";
- public static final String DEPLOY_AFTER_BUILD =
"org.jboss.ide.eclipse.as.core.model.PackagesListener.DeployAfterBuild";
-
- public static ArchivesBuildListener getInstance() {
- if( instance == null ) {
- instance = new ArchivesBuildListener();
- }
- return instance;
- }
-
- public ArchivesBuildListener() {
- ArchivesModel.instance().addBuildListener(this);
- ArchivesModel.instance().addModelListener(this, ArchivesModel.LIST_FRONT);
- }
-
- public void cleanArchive(IArchive pkg) {
- }
-
-
- public void finishedBuildingArchive(IArchive pkg) {
- if( pkg.isTopLevel() && new
Boolean(pkg.getProperty(DEPLOY_AFTER_BUILD)).booleanValue()) {
- publish(pkg);
- }
- }
-
- public void fileRemoved(IArchive topLevelPackage, IArchiveFileSet fileset, IPath
filePath) {
- }
- public void fileUpdated(IArchive topLevelPackage, IArchiveFileSet fileset, IPath
filePath) {
- }
-
- // If we're supposed to auto-deploy, get on it
- protected static void publish(IArchive pkg) {
- String servers = pkg.getProperty(ArchivesBuildListener.DEPLOY_SERVERS);
- publish(pkg, servers, IServer.PUBLISH_INCREMENTAL);
- }
- public static void publish(IArchive pkg, String servers, int publishType) {
- IModule[] module = getModule(pkg);
- if( module[0] == null ) return;
- DeployableServerBehavior[] serverBehaviors =
ArchivesBuildListener.getServers(servers);
- if( serverBehaviors != null ) {
- for( int i = 0; i < serverBehaviors.length; i++ ) {
- serverBehaviors[i].publishOneModule(publishType, module,
ServerBehaviourDelegate.CHANGED, new NullProgressMonitor());
- }
- }
- }
- protected static IModule[] getModule(IArchive node) {
- ModuleFactory factory =
ServerPlugin.findModuleFactory("org.jboss.ide.eclipse.as.core.PackageModuleFactory");
- IModule mod = factory.findModule(PackageModuleFactory.getID(node), new
NullProgressMonitor());
- return new IModule[] { mod };
- }
- protected static PackagedModuleDelegate getModuleDelegate(IArchive node) {
- IModule mod = getModule(node)[0];
- return (PackagedModuleDelegate)mod.loadAdapter(PackagedModuleDelegate.class, new
NullProgressMonitor());
- }
-
- protected IDeployableServer getDeployableServerFromBehavior(DeployableServerBehavior
dsb) {
- IServer server = dsb.getServer();
- IDeployableServer ids = (IDeployableServer)server.loadAdapter(IDeployableServer.class,
new NullProgressMonitor());
- return ids;
- }
-
- public static DeployableServerBehavior[] getServers(String servers) {
- if( servers == null || "".equals(servers))
- return null;
- ArrayList list = new ArrayList();
- String[] byId = servers.split(",");
- for( int i = 0; i < byId.length; i++ ) {
- IServer server = ServerCore.findServer(byId[i]);
- if( server != null ) {
- Object o = server.loadAdapter(DeployableServerBehavior.class, new
NullProgressMonitor());
- if( o != null ) {
- list.add((DeployableServerBehavior)o);
- }
- }
- }
- return (DeployableServerBehavior[]) list.toArray(new
DeployableServerBehavior[list.size()]);
- }
-
- /*
- * If a node is changing from exploded to imploded, or vice versa
- * make sure to delete the pre-existing file or folder on the server.
- */
- public void packageBuildTypeChanged(IArchive topLevelPackage, boolean isExploded) {
- String servers = topLevelPackage.getProperty(ArchivesBuildListener.DEPLOY_SERVERS);
- DeployableServerBehavior[] serverBehaviors =
ArchivesBuildListener.getServers(servers);
- if( serverBehaviors != null ) {
- IPath sourcePath, destPath;
- IDeployableServer depServer;
- for( int i = 0; i < serverBehaviors.length; i++ ) {
- sourcePath = topLevelPackage.getArchiveFilePath();
- depServer = getDeployableServerFromBehavior(serverBehaviors[i]);
- destPath = new
Path(depServer.getDeployDirectory()).append(sourcePath.lastSegment());
- FileUtil.safeDelete(destPath.toFile());
- FileUtil.fileSafeCopy(sourcePath.toFile(), destPath.toFile());
- }
- }
- }
-
- public void buildFailed(IArchive pkg, IStatus status) {
- // TODO Auto-generated method stub
-
- }
-
- public void finishedBuild(IPath project) {
- // TODO Auto-generated method stub
-
- }
-
- public void finishedCollectingFileSet(IArchiveFileSet fileset) {
- // TODO Auto-generated method stub
-
- }
-
- public void startedBuild(IPath project) {
- // TODO Auto-generated method stub
-
- }
-
- public void startedBuildingArchive(IArchive pkg) {
- // TODO Auto-generated method stub
-
- }
-
- public void startedCollectingFileSet(IArchiveFileSet fileset) {
- // TODO Auto-generated method stub
- }
- public void startedBuildingPackage(IArchive pkg) {
- // TODO Auto-generated method stub
- }
-
- public void cleanProject(IPath project) {
- }
-
- public void modelChanged(IArchiveNodeDelta delta) {
- IPath p ;
- if( delta.getPreNode() == null )
- p = delta.getPostNode().getProjectPath();
- else
- p = delta.getPreNode().getProjectPath();
-
- ArchivesModelModuleContributor.getInstance().refreshProject(p);
- }
-
-
-}
Deleted:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/ArchivesModelModuleContributor.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/ArchivesModelModuleContributor.java 2007-09-11
05:25:21 UTC (rev 3536)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/ArchivesModelModuleContributor.java 2007-09-11
05:26:57 UTC (rev 3537)
@@ -1,130 +0,0 @@
-package org.jboss.ide.eclipse.as.core.packages;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.wst.server.core.IModule;
-import org.jboss.ide.eclipse.archives.core.model.ArchivesModel;
-import org.jboss.ide.eclipse.archives.core.model.ArchivesModelCore;
-import org.jboss.ide.eclipse.archives.core.model.IArchive;
-import org.jboss.ide.eclipse.as.core.packages.PackageModuleFactory.IModuleContributor;
-import
org.jboss.ide.eclipse.as.core.packages.PackageModuleFactory.PackagedModuleDelegate;
-
-public class ArchivesModelModuleContributor implements IModuleContributor {
-
- private static ArchivesModelModuleContributor instance;
- public static ArchivesModelModuleContributor getInstance() {
- if( instance == null ) {
- instance = new ArchivesModelModuleContributor(PackageModuleFactory.getFactory());
- }
- return instance;
- }
-
- private PackageModuleFactory factory;
- protected ArrayList modules = null;
- protected HashMap projectToModules = new HashMap(5); //IPath to IModule
- protected HashMap moduleDelegates = new HashMap(5);
- protected HashMap packageToModule = new HashMap(5);
-
- private ArchivesModelModuleContributor(PackageModuleFactory factory) {
- this.factory = factory;
- }
-
- public IModule[] getModules() {
- if( modules == null ) {
- modules = new ArrayList();
- IProject[] projects2 = ResourcesPlugin.getWorkspace().getRoot().getProjects();
- int size = projects2.length;
- for (int i = 0; i < size; i++) {
- if (projects2[i].isAccessible()) {
- createModules(projects2[i]);
- }
- }
- }
- return (IModule[]) modules.toArray(new IModule[modules.size()]);
- }
-
- protected void createModules(IProject project) {
- IArchive[] packs = ArchivesModelCore.getProjectPackages(project.getLocation(), null,
false);
- if( packs != null && packs.length > 0 ) {
- IModule module;
- IArchive[] packages = ArchivesModelCore.getProjectPackages(project.getLocation(), new
NullProgressMonitor(), true);
- boolean requiresSave = ensureArchivesHaveIDs(project, packages);
- ArrayList mods = new ArrayList();
- for( int i = 0; i < packages.length; i++ ) {
- module = factory.createModule2(packages[i], project);
- modules.add(module);
- Object moduleDelegate = new PackagedModuleDelegate(packages[i]);
- packageToModule.put(packages[i], module);
- moduleDelegates.put(module, moduleDelegate);
- mods.add(module);
- }
- projectToModules.put(project.getLocation(), mods);
- }
- }
-
- public boolean containsModule(IModule module) {
- return moduleDelegates.containsKey(module);
- }
-
- public PackagedModuleDelegate getModuleDelegate(IModule module) {
- return (PackagedModuleDelegate)moduleDelegates.get(module);
- }
-
- public void refreshProject(IPath projectLoc) {
- // remove old mods
- ArrayList mods = (ArrayList)projectToModules.get(projectLoc);
- IModule mod;
- IArchive arc;
- if (mods != null) {
- for( Iterator i = mods.iterator(); i.hasNext();) {
- mod = (IModule)i.next();
- if( moduleDelegates.get(mod) != null ) {
- arc = ((PackagedModuleDelegate)moduleDelegates.get(mod)).getPackage();
- packageToModule.remove(arc);
- moduleDelegates.remove(mod);
- }
- }
- }
- createModules(findProject(projectLoc));
- factory.clearModuleCache();
- }
-
- protected IProject findProject(IPath projectLoc) {
- IProject proj = null;
- IProject[] projects2 = ResourcesPlugin.getWorkspace().getRoot().getProjects();
- int size = projects2.length;
- for (int i = 0; i < size; i++) {
- if( projects2[i].getLocation().equals(projectLoc))
- proj = projects2[i];
- }
- return proj;
- }
-
- /**
- * Set a property so that each module that's here in the factory
- * has a unique ID other than it's name (which is not unique)
- * @param archives
- * @return returns whether a save has occurred
- */
- protected boolean ensureArchivesHaveIDs(IProject project, IArchive[] archives) {
- boolean requiresSave = false;
- for( int i = 0; i < archives.length; i++ ) {
- if( PackageModuleFactory.getID(archives[i]) == null ) {
- requiresSave = true;
- archives[i].setProperty(PackageModuleFactory.MODULE_ID_PROPERTY_KEY,
- PackageModuleFactory.getID(archives[i], true));
- }
- }
- if( requiresSave ) {
- // save
- ArchivesModel.instance().saveModel(project.getLocation(), new NullProgressMonitor());
- }
- return requiresSave;
- }
-}
Deleted:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/ModulePackageTypeConverter.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/ModulePackageTypeConverter.java 2007-09-11
05:25:21 UTC (rev 3536)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/ModulePackageTypeConverter.java 2007-09-11
05:26:57 UTC (rev 3537)
@@ -1,48 +0,0 @@
-/**
- * JBoss, a Division of Red Hat
- * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
-* This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ide.eclipse.as.core.packages;
-
-import org.eclipse.wst.server.core.IModule;
-import org.jboss.ide.eclipse.archives.core.ArchivesCore;
-import org.jboss.ide.eclipse.archives.core.model.IArchiveType;
-import org.jboss.ide.eclipse.as.core.packages.types.EarArchiveType;
-import org.jboss.ide.eclipse.as.core.packages.types.EjbArchiveType;
-import org.jboss.ide.eclipse.as.core.packages.types.WarArchiveType;
-
-/**
- *
- * @author rob.stryker(a)jboss.com
- */
-public class ModulePackageTypeConverter {
- public static IArchiveType getPackageTypeFor(IModule module) {
- String modType = module.getModuleType().getId();
- if("jst.web".equals(modType)) {
- return
ArchivesCore.getInstance().getExtensionManager().getArchiveType(WarArchiveType.WAR_PACKAGE_TYPE);
- } else if("jst.ear".equals(modType)) {
- return
ArchivesCore.getInstance().getExtensionManager().getArchiveType(EarArchiveType.ID);
- } else if("jst.ejb".equals(modType)) {
- return
ArchivesCore.getInstance().getExtensionManager().getArchiveType(EjbArchiveType.ID);
- }
-
- return null;
- }
-}
Deleted:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/PackageModuleFactory.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/PackageModuleFactory.java 2007-09-11
05:25:21 UTC (rev 3536)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/PackageModuleFactory.java 2007-09-11
05:26:57 UTC (rev 3537)
@@ -1,437 +0,0 @@
-/**
- * JBoss, a Division of Red Hat
- * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
-* This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ide.eclipse.as.core.packages;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.preferences.IEclipsePreferences;
-import org.eclipse.core.runtime.preferences.InstanceScope;
-import org.eclipse.wst.server.core.IModule;
-import org.eclipse.wst.server.core.internal.ModuleFactory;
-import org.eclipse.wst.server.core.internal.ModuleFile;
-import org.eclipse.wst.server.core.internal.ServerPlugin;
-import org.eclipse.wst.server.core.model.IModuleFile;
-import org.eclipse.wst.server.core.model.IModuleFolder;
-import org.eclipse.wst.server.core.model.IModuleResource;
-import org.eclipse.wst.server.core.model.ModuleDelegate;
-import org.eclipse.wst.server.core.model.ModuleFactoryDelegate;
-import org.jboss.ide.eclipse.archives.core.model.IArchive;
-import org.jboss.ide.eclipse.archives.core.model.IArchiveFileSet;
-import org.jboss.ide.eclipse.archives.core.model.IArchiveFolder;
-import org.jboss.ide.eclipse.archives.core.model.IArchiveNode;
-import org.jboss.ide.eclipse.archives.core.model.IArchiveNodeVisitor;
-import org.jboss.ide.eclipse.archives.core.util.ModelUtil;
-import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
-import org.osgi.service.prefs.BackingStoreException;
-
-/**
- *
- * @author rob.stryker(a)jboss.com
- */
-public class PackageModuleFactory extends ModuleFactoryDelegate {
-
- private static int nextArchiveId = -1;
- private static final String NEXT_ARCHIVE_KEY =
"org.jboss.ide.eclipse.as.core.PackageModuleFactory.nextId";
-
- public static final String FACTORY_TYPE_ID =
"org.jboss.ide.eclipse.as.core.PackageModuleFactory";
- public static final String MODULE_TYPE = "jboss.package";
- public static final String VERSION = "1.0";
-
- public static final String MODULE_ID_PROPERTY_KEY =
"org.jboss.ide.eclipse.as.core.packages.ModuleIDPropertyKey";
-
- // the factory delegate and the factory respectively
- private static PackageModuleFactory factDelegate;
- private static ModuleFactory factory;
-
- /**
- * Find the module factory wrapper WTP provides for us
- * @return
- */
- public static PackageModuleFactory getFactory() {
- if( factDelegate == null ) {
- ModuleFactory[] factories = ServerPlugin.getModuleFactories();
-
- for( int i = 0; i < factories.length; i++ ) {
- if( factories[i].getId().equals(PackageModuleFactory.FACTORY_TYPE_ID)) {
- Object o = factories[i].getDelegate(new NullProgressMonitor());
- if( o instanceof PackageModuleFactory ) {
- factory = factories[i];
- factDelegate = (PackageModuleFactory)o;
- return factDelegate;
- }
- }
- }
- }
- return factDelegate;
- }
-
- /**
- * Get the module ID of this IArchive if it exists.
- * Do not create a new one otherwise
- * @param pack
- * @return
- */
- public static String getID(IArchive pack) {
- return getID(pack, false);
- }
-
- /**
- * Get the module ID of this IArchive if it exists.
- * If create is true, and the ID is not set, set a default ID.
- * @param pack
- * @param create
- * @return
- */
- protected static String getID(IArchive pack, boolean create) {
- String propVal = pack.getProperty(MODULE_ID_PROPERTY_KEY);
- if( propVal == null && create ) {
- if( nextArchiveId == -1 ) {
- nextArchiveId =
- new
InstanceScope().getNode(JBossServerCorePlugin.PLUGIN_ID).getInt(NEXT_ARCHIVE_KEY, 0);
- }
- nextArchiveId++;
- IEclipsePreferences prefs = new
InstanceScope().getNode(JBossServerCorePlugin.PLUGIN_ID);
- prefs.putInt(NEXT_ARCHIVE_KEY, nextArchiveId);
- try {
- prefs.flush();
- } catch( BackingStoreException bse ) {
- }
- return "" + nextArchiveId;
- } else if( propVal == null ) {
- return null;
- }
- return propVal;
- }
-
- /**
- * Return the name of the project in the workspace
- * @param node
- * @return
- */
- public static String getProjectName(IArchiveNode node) {
- IPath projPath = node.getProjectPath();
- if( projPath == null ) return null;
- IProject[] list = ResourcesPlugin.getWorkspace().getRoot().getProjects();
- for( int i = 0; i < list.length; i++ )
- if( list[i].getLocation().equals(projPath))
- return list[i].getName();
- return null;
- }
-
- /**
- * Get the visible name of this module
- * @param pack
- * @return
- */
- public static String getName(IArchive pack) {
- return getProjectName(pack) + "/" + pack.getName();
- }
-
-
-
- protected IModuleContributor[] moduleContributors;
- public PackageModuleFactory() {
- super();
- moduleContributors = new IModuleContributor[] {
ArchivesModelModuleContributor.getInstance() };
-
- }
-
- protected IModule createModule2(IArchive pack, IProject project) {
- return createModule(getID(pack), getName(pack), MODULE_TYPE, VERSION, project);
- }
-
-
- public IModule[] getModules() {
- ArrayList list = new ArrayList();
- for( int i = 0; i < moduleContributors.length; i++ ) {
- list.addAll(Arrays.asList(moduleContributors[i].getModules()));
- }
- return (IModule[]) list.toArray(new IModule[list.size()]);
- }
-
- public ModuleDelegate getModuleDelegate(IModule module) {
- for( int i = 0; i < moduleContributors.length; i++ ) {
- if( moduleContributors[i].containsModule(module))
- return moduleContributors[i].getModuleDelegate(module);
- }
- return null;
- }
-
- public static interface IModuleContributor {
- public IModule[] getModules();
- public boolean containsModule(IModule module);
- public PackagedModuleDelegate getModuleDelegate(IModule module);
- }
-
- public static interface IExtendedModuleResource extends IModuleResource {
- public IPath getSourcePath();
- public IArchiveNode getNode();
- public IPath getDeepDestination();
- public IPath getConcreteDestFile();
- }
-
- public static class DelegateInitVisitor implements IArchiveNodeVisitor {
-
- private IArchive pack;
- private HashMap members; // node -> imoduleresource
- private HashMap pathToNode; // path -> node
- public DelegateInitVisitor(IArchive pack) {
- this.pack = pack;
- reset();
- }
- public void reset() {
- members = new HashMap();
- pathToNode = new HashMap();
- }
- public boolean visit(IArchiveNode node) {
- int type = node.getNodeType();
- if( type == IArchiveNode.TYPE_ARCHIVE && ((IArchive)node).isTopLevel()) {
- IPath rel = ((IArchive)node).getRootArchiveRelativePath();
- members.put(node, new ArchiveContainerResource(((IArchive)node).getName(), node,
rel));
- pathToNode.put(rel, node);
- } else if( type == IArchiveNode.TYPE_ARCHIVE || type ==
IArchiveNode.TYPE_ARCHIVE_FOLDER) {
- String name = type == IArchiveNode.TYPE_ARCHIVE ? ((IArchive)node).getName() :
((IArchiveFolder)node).getName();
- // if we're any other archive or a folder, create us and add to parent
- IArchiveNode parent = node.getParent();
- ArchiveContainerResource parentAsResource =
(ArchiveContainerResource)members.get(parent);
- IPath rel = node.getRootArchiveRelativePath();
- members.put(node, new ArchiveContainerResource(name, node, rel));
- pathToNode.put(rel, node);
- parentAsResource.addChild((IModuleResource)members.get(node));
- } else if( type == IArchiveNode.TYPE_ARCHIVE_FILESET ) {
- ArchiveContainerResource parentAsResource =
(ArchiveContainerResource)members.get(node.getParent());
- parentAsResource.addFilesetAsChild((IArchiveFileSet)node);
- }
-
- return true;
- }
-
- public IModuleResource getRootResource() {
- return (IModuleResource)members.get(pack);
- }
-
- public IModuleResource getResourceForNode(IArchiveNode node) {
- return (IModuleResource)members.get(node);
- }
- }
-
- public static class ArchiveContainerResource implements IModuleFolder,
IExtendedModuleResource {
-
- protected IPath moduleRelativePath;
- protected IArchiveNode node;
- protected String name;
- private HashMap members;
-
- // represents source folder on disk. only used if node is fileset
- private IPath folderGlobalPath = null;
- public ArchiveContainerResource(String name,IArchiveNode node,IPath moduleRelativePath
) {
- this.name = name;
- this.node = node;
- this.moduleRelativePath = moduleRelativePath;
- members = new HashMap();
- if( node instanceof IArchiveFileSet) {
- IPath tmp =
moduleRelativePath.removeFirstSegments(node.getParent().getRootArchiveRelativePath().segmentCount());
- folderGlobalPath = ((IArchiveFileSet)node).getGlobalSourcePath().append(tmp);
- }
- }
-
- public int hashCode() {
- return name.hashCode() * 37 + moduleRelativePath.hashCode();
- }
-
- public boolean equals(Object other) {
- if (other instanceof IModuleFolder) {
- IModuleFolder resource = (IModuleFolder) other;
- return resource.getModuleRelativePath().equals(getModuleRelativePath());
- }
- return false;
- }
-
- public void addChild(IModuleResource resource) {
- members.put(resource.getModuleRelativePath(), resource);
- }
-
- public void removeChild(IPath moduleRelativePath) {
- members.remove(moduleRelativePath);
- }
- public IModuleResource getChild(IPath path) {
- return (IModuleResource)members.get(path);
- }
-
- public void addFilesetAsChild(IArchiveFileSet fs) {
- IPath[] paths = fs.findMatchingPaths(); // file-system based source paths
- IPath globalSource = fs.getGlobalSourcePath();
- for( int i = 0; i < paths.length; i++ ) {
- addFilesetPathAsChild(fs, globalSource, paths[i]);
- }
- }
-
- public void addFilesetPathAsChild(IArchiveFileSet fs, IPath globalSource, IPath path)
{
- IPath archiveRelative = fs.getRootArchiveRelativePath(path);
- IPath fsRelative = path.removeFirstSegments(globalSource.segmentCount());
- ArchiveContainerResource parent = find(fs, globalSource,
fsRelative.removeLastSegments(1), true);
- ExtendedModuleFile emf = new ExtendedModuleFile(archiveRelative.lastSegment(),
archiveRelative, path.toFile().lastModified(), path, fs);
- parent.addChild(emf);
- }
-
- public void removeFilesetPathAsChild(IArchiveFileSet fs, IPath path) {
- IPath globalSource = fs.getGlobalSourcePath();
- IPath fsRelative = path.removeFirstSegments(globalSource.segmentCount());
- ArchiveContainerResource parent = find(fs, globalSource,
fsRelative.removeLastSegments(1), false);
- if( parent != null )
- parent.removeFilesetPathAsChild(fs, path);
- }
-
- protected ArchiveContainerResource find(IArchiveFileSet fs, IPath globalSource, IPath
fsRelative, boolean create) {
- ArchiveContainerResource resource = this;
- ArchiveContainerResource tmpResource;
- IPath tmpPath = fs.getRootArchiveRelativePath();
- int count = fsRelative.segmentCount();
- for( int i = 0; i < count; i++ ) {
- tmpPath = tmpPath.append(fsRelative.segment(i));
- tmpResource = (ArchiveContainerResource)resource.getChild(tmpPath);
- if( tmpResource == null ) {
- if( !create )
- return null;
- tmpResource = new ArchiveContainerResource(tmpPath.lastSegment(), fs, tmpPath);
- resource.addChild(tmpResource);
- }
- resource = tmpResource;
- }
- return resource;
- }
-
- public IModuleResource[] members() {
- Collection c = members.values();
- return (IModuleResource[]) c.toArray(new IModuleResource[c.size()]);
- }
-
- public IPath getModuleRelativePath() {
- return moduleRelativePath;
- }
-
- public String getName() {
- return name;
- }
-
- public Object getAdapter(Class adapter) {
- return null;
- }
-
- public IPath getDeepDestination() {
- IPath tmp = node.getNodeType() == IArchiveNode.TYPE_ARCHIVE_FILESET ?
- ((IArchiveFileSet)node).getRootArchiveRelativePath(folderGlobalPath) :
node.getRootArchiveRelativePath();
- return node.getRootArchive().getGlobalDestinationPath().append(tmp);
- }
- public IPath getConcreteDestFile() {
- return ModelUtil.getBaseDestinationFile(node,folderGlobalPath);
- }
- public IArchiveNode getNode() {
- return node;
- }
-
- public IPath getSourcePath() {
- return null;
- }
-
- }
-
- public static class ExtendedModuleFile extends ModuleFile implements
IExtendedModuleResource {
- private IPath srcPath;
- private IArchiveFileSet node;
- public ExtendedModuleFile(String name, IPath relativePath, long stamp,
- IPath srcPath, IArchiveFileSet fs) {
- super(name, relativePath, stamp);
- this.srcPath = srcPath;
- this.node = fs;
- }
- public int hashCode() {
- return name.hashCode() * 37 + path.hashCode();
- }
-
- public IPath getPath() { return srcPath; }
- public IArchiveNode getNode() { return node; }
- public IPath getDeepDestination() {
- return
node.getRootArchive().getGlobalDestinationPath().append(node.getRootArchiveRelativePath(path));
- }
- public IPath getSourcePath() {
- return this.srcPath;
- }
-
- public IPath getConcreteDestFile() {
- return ModelUtil.getBaseDestinationFile(node, srcPath);
- }
-
- public boolean equals(Object other) {
- if (other instanceof IModuleFile) {
- IModuleFile resource = (IModuleFile) other;
- return resource.getModuleRelativePath().equals(getModuleRelativePath());
- }
- return false;
- }
-
- }
-
- public static class PackagedModuleDelegate extends ModuleDelegate {
- private IArchive pack;
- private IModuleResource rootResource;
- private DelegateInitVisitor initVisitor;
- public PackagedModuleDelegate(IArchive pack) {
- this.pack = pack;
- initVisitor = new DelegateInitVisitor(pack);
- }
-
- public IArchive getPackage() {
- return pack;
- }
- public IModule[] getChildModules() {
- return new IModule[0];
- }
-
- protected void init() {
- initVisitor.reset();
- pack.accept(initVisitor);
- rootResource = initVisitor.getRootResource();
- }
-
- public IModuleResource[] members() throws CoreException {
- init();
- return new IModuleResource[] { rootResource };
- }
-
- public IStatus validate() {
- return new Status(IStatus.OK, JBossServerCorePlugin.PLUGIN_ID,
- 0, "", null);
- }
- }
-
-}
Deleted:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/PackagedArtifactAdapter.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/PackagedArtifactAdapter.java 2007-09-11
05:25:21 UTC (rev 3536)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/PackagedArtifactAdapter.java 2007-09-11
05:26:57 UTC (rev 3537)
@@ -1,56 +0,0 @@
-package org.jboss.ide.eclipse.as.core.packages;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.wst.server.core.IModule;
-import org.eclipse.wst.server.core.IModuleArtifact;
-import org.eclipse.wst.server.core.model.ModuleArtifactAdapterDelegate;
-
-public class PackagedArtifactAdapter extends ModuleArtifactAdapterDelegate {
-
- public PackagedArtifactAdapter() {
- }
-
- public IModuleArtifact getModuleArtifact(Object obj) {
- if( obj instanceof IJavaProject ) {
- IProject[] projects2 = ResourcesPlugin.getWorkspace().getRoot().getProjects();
- boolean done = false;
- String jpName = ((IJavaProject)obj).getElementName();
- for( int i = 0; i < projects2.length && !done; i++ ) {
- if( projects2[i].getName().equals(jpName)) {
- done = true;
- obj = projects2[i];
- break;
- }
- }
- }
-
- if( obj instanceof IProject ) {
- PackageModuleFactory factory = PackageModuleFactory.getFactory();
- if( factory != null ) {
-// IModule[] mods = factory.getModulesFromProject((IProject)obj);
-// if( mods != null && mods.length != 0) {
-// return getArtifact(mods);
-// }
- }
- }
- return null;
- }
-
- protected IModuleArtifact getArtifact(IModule[] mod) {
- //return new PackagedArtifact(mod);
- // TODO Blocking on eclipse bug 174372
- return null;
- }
-
- public class PackagedArtifact implements IModuleArtifact{
- protected IModule mod;
- public PackagedArtifact(IModule module) {
- this.mod = module;
- }
- public IModule getModule() {
- return mod;
- }
- }
-}
Deleted:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/SingleDeployableFactory.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/SingleDeployableFactory.java 2007-09-11
05:25:21 UTC (rev 3536)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/SingleDeployableFactory.java 2007-09-11
05:26:57 UTC (rev 3537)
@@ -1,156 +0,0 @@
-package org.jboss.ide.eclipse.as.core.packages;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.wst.server.core.IModule;
-import org.eclipse.wst.server.core.internal.ModuleFactory;
-import org.eclipse.wst.server.core.internal.ModuleFile;
-import org.eclipse.wst.server.core.internal.ServerPlugin;
-import org.eclipse.wst.server.core.model.IModuleResource;
-import org.eclipse.wst.server.core.model.ModuleDelegate;
-import org.eclipse.wst.server.core.model.ModuleFactoryDelegate;
-import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
-
-public class SingleDeployableFactory extends ModuleFactoryDelegate {
- public static final String FACTORY_ID =
"org.jboss.ide.eclipse.as.core.singledeployablefactory";
- private static SingleDeployableFactory factDelegate;
- public static final String MODULE_TYPE = "jboss.singlefile";
- public static final String VERSION = "1.0";
- private static final String PREFERENCE_KEY =
"org.jboss.ide.eclipse.as.core.singledeployable.deployableList";
- private static final String DELIM = "\r";
-
-
- private static ModuleFactory factory;
- public static SingleDeployableFactory getFactory() {
- if( factDelegate == null ) {
- ModuleFactory[] factories = ServerPlugin.getModuleFactories();
- for( int i = 0; i < factories.length; i++ ) {
- if( factories[i].getId().equals(FACTORY_ID)) {
- Object o = factories[i].getDelegate(new NullProgressMonitor());
- if( o instanceof SingleDeployableFactory ) {
- factory = factories[i];
- factDelegate = (SingleDeployableFactory)o;
- return factDelegate;
- }
- }
- }
- }
- return factDelegate;
- }
-
- public static boolean makeDeployable(IResource resource) {
- return makeDeployable(resource.getFullPath());
- }
-
- public static boolean makeDeployable(IPath workspaceRelative) {
- boolean ret = getFactory().addModule(workspaceRelative);
- getFactory().saveDeployableList();
- return ret;
- }
-
- public static void unmakeDeployable(IResource resource) {
- unmakeDeployable(resource.getFullPath());
- }
-
- public static void unmakeDeployable(IPath workspaceRelative) {
- getFactory().removeModule(workspaceRelative);
- getFactory().saveDeployableList();
- }
-
- public static IModule findModule(IResource resource) {
- return findModule(resource.getFullPath());
- }
- public static IModule findModule(IPath workspaceRelative) {
- return getFactory().getModule(workspaceRelative);
- }
-
-
-
- private HashMap moduleIdToModule;
- private HashMap moduleToDelegate;
- public SingleDeployableFactory() {
- moduleIdToModule = new HashMap();
- moduleToDelegate = new HashMap();
- String files =
JBossServerCorePlugin.getDefault().getPluginPreferences().getString(PREFERENCE_KEY);
- if( files.equals("")) return;
- String[] files2 = files.split(DELIM);
- for( int i = 0; i < files2.length; i++ ) {
- addModule(new Path(files2[i]));
- }
- }
-
- public IModule getModule(IPath path) {
- return (IModule)moduleIdToModule.get(path);
- }
- public void saveDeployableList() {
- Iterator i = moduleIdToModule.keySet().iterator();
- String val = "";
- while(i.hasNext()) {
- val += ((IPath)i.next()).toString() + DELIM;
- }
- JBossServerCorePlugin.getDefault().getPluginPreferences().setValue(PREFERENCE_KEY,
val);
- JBossServerCorePlugin.getDefault().savePluginPreferences();
- }
-
- protected boolean addModule(IPath path) {
- IResource resource = ResourcesPlugin.getWorkspace().getRoot().findMember(path);
- if( resource != null && resource.exists() ) {
- IModule module = createModule(path.toString(), path.toString(), MODULE_TYPE, VERSION,
resource.getProject());
- moduleIdToModule.put(path, module);
- moduleToDelegate.put(module, new SingleDeployableModuleDelegate(path));
- return true;
- } else {
- return false;
- }
- }
-
- protected void removeModule(IPath path) {
- IModule mod = (IModule)moduleIdToModule.get(path);
- moduleIdToModule.remove(path);
- moduleToDelegate.remove(mod);
- }
-
- public IModule[] getModules() {
- Collection c = moduleIdToModule.values();
- return (IModule[]) c.toArray(new IModule[c.size()]);
- }
-
- public ModuleDelegate getModuleDelegate(IModule module) {
- return (ModuleDelegate)moduleToDelegate.get(module);
- }
-
- public class SingleDeployableModuleDelegate extends ModuleDelegate {
- private IPath global;
- public SingleDeployableModuleDelegate(IPath workspaceRelative) {
- global =
ResourcesPlugin.getWorkspace().getRoot().getLocation().append(workspaceRelative);
- }
- public IModule[] getChildModules() {
- return new IModule[0];
- }
-
- public IModuleResource[] members() throws CoreException {
- return new IModuleResource[] {
- new ModuleFile(global.lastSegment(),
- new Path(global.lastSegment()),
- global.toFile().lastModified()) };
- }
-
- public IStatus validate() {
- return Status.OK_STATUS;
- }
-
- public IPath getGlobalSourcePath() {
- return this.global;
- }
- }
-}
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/types/EarArchiveType.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/types/EarArchiveType.java 2007-09-11
05:25:21 UTC (rev 3536)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/packages/types/EarArchiveType.java 2007-09-11
05:26:57 UTC (rev 3537)
@@ -11,7 +11,7 @@
import org.jboss.ide.eclipse.archives.core.model.IArchive;
import org.jboss.ide.eclipse.archives.core.model.IArchiveFolder;
import org.jboss.ide.eclipse.archives.core.model.IArchiveType;
-import org.jboss.ide.eclipse.as.core.packages.ModulePackageTypeConverter;
+import org.jboss.ide.eclipse.as.core.modules.ModulePackageTypeConverter;
public class EarArchiveType extends J2EEArchiveType {
public final static String ID =
"org.jboss.ide.eclipse.as.core.packages.earPackageType";
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-11
05:25:21 UTC (rev 3536)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/PackagesPublisher.java 2007-09-11
05:26:57 UTC (rev 3537)
@@ -36,9 +36,9 @@
import org.eclipse.wst.server.core.model.ServerBehaviourDelegate;
import org.jboss.ide.eclipse.archives.core.model.IArchive;
import org.jboss.ide.eclipse.as.core.extensions.events.EventLogModel.EventLogTreeItem;
-import org.jboss.ide.eclipse.as.core.packages.PackageModuleFactory.ExtendedModuleFile;
-import
org.jboss.ide.eclipse.as.core.packages.PackageModuleFactory.IExtendedModuleResource;
-import
org.jboss.ide.eclipse.as.core.packages.PackageModuleFactory.PackagedModuleDelegate;
+import org.jboss.ide.eclipse.as.core.modules.PackageModuleFactory.ExtendedModuleFile;
+import
org.jboss.ide.eclipse.as.core.modules.PackageModuleFactory.IExtendedModuleResource;
+import
org.jboss.ide.eclipse.as.core.modules.PackageModuleFactory.PackagedModuleDelegate;
import org.jboss.ide.eclipse.as.core.publishers.PublisherEventLogger.PublishEvent;
import
org.jboss.ide.eclipse.as.core.publishers.PublisherEventLogger.PublisherFileUtilListener;
import org.jboss.ide.eclipse.as.core.server.attributes.IDeployableServer;
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-11
05:25:21 UTC (rev 3536)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/SingleFilePublisher.java 2007-09-11
05:26:57 UTC (rev 3537)
@@ -10,8 +10,8 @@
import org.eclipse.wst.server.core.IServer;
import org.eclipse.wst.server.core.model.IModuleResourceDelta;
import org.eclipse.wst.server.core.model.ServerBehaviourDelegate;
-import org.jboss.ide.eclipse.as.core.packages.SingleDeployableFactory;
-import
org.jboss.ide.eclipse.as.core.packages.SingleDeployableFactory.SingleDeployableModuleDelegate;
+import org.jboss.ide.eclipse.as.core.modules.SingleDeployableFactory;
+import
org.jboss.ide.eclipse.as.core.modules.SingleDeployableFactory.SingleDeployableModuleDelegate;
import org.jboss.ide.eclipse.as.core.server.attributes.IDeployableServer;
import org.jboss.ide.eclipse.as.core.util.FileUtil;
import org.jboss.ide.eclipse.as.core.util.ServerConverter;
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/DeployableServerBehavior.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/DeployableServerBehavior.java 2007-09-11
05:25:21 UTC (rev 3536)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/DeployableServerBehavior.java 2007-09-11
05:26:57 UTC (rev 3537)
@@ -19,7 +19,7 @@
import org.eclipse.wst.server.core.model.ServerBehaviourDelegate;
import org.jboss.ide.eclipse.as.core.extensions.events.EventLogModel;
import org.jboss.ide.eclipse.as.core.extensions.events.EventLogModel.EventLogTreeItem;
-import org.jboss.ide.eclipse.as.core.packages.PackageModuleFactory;
+import org.jboss.ide.eclipse.as.core.modules.PackageModuleFactory;
import org.jboss.ide.eclipse.as.core.publishers.IJBossServerPublisher;
import org.jboss.ide.eclipse.as.core.publishers.JstPublisher;
import org.jboss.ide.eclipse.as.core.publishers.NullPublisher;
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml 2007-09-11 05:25:21 UTC (rev
3536)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml 2007-09-11 05:26:57 UTC (rev
3537)
@@ -241,7 +241,7 @@
<extension
point="org.eclipse.wst.server.core.moduleFactories">
<moduleFactory
-
class="org.jboss.ide.eclipse.as.core.packages.PackageModuleFactory"
+ class="org.jboss.ide.eclipse.as.core.modules.PackageModuleFactory"
id="org.jboss.ide.eclipse.as.core.PackageModuleFactory"
projects="true">
<moduleType
@@ -249,7 +249,7 @@
versions="1.0"/>
</moduleFactory>
<moduleFactory
-
class="org.jboss.ide.eclipse.as.core.packages.SingleDeployableFactory"
+
class="org.jboss.ide.eclipse.as.core.modules.SingleDeployableFactory"
id="org.jboss.ide.eclipse.as.core.singledeployablefactory"
projects="false">
<moduleType
@@ -266,7 +266,7 @@
<extension
point="org.eclipse.wst.server.core.moduleArtifactAdapters">
<moduleArtifactAdapter
-
class="org.jboss.ide.eclipse.as.core.packages.PackagedArtifactAdapter"
+
class="org.jboss.ide.eclipse.as.core.modules.PackagedArtifactAdapter"
id="org.jboss.ide.eclipse.as.core.PackagedArtifactAdapter"
priority="0">
<enablement>