Author: akazakov
Date: 2009-01-27 14:03:43 -0500 (Tue, 27 Jan 2009)
New Revision: 13295
Removed:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetPostInstallDelegate.java
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetAbstractInstallDelegate.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDataModelProvider.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamProjectCreator.java
trunk/seam/plugins/org.jboss.tools.seam.ui/META-INF/MANIFEST.MF
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamProjectWizard.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-3612 New Seam Project Wizard: Seam EJB project is
not published. - Fixed.
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml 2009-01-27 17:46:18 UTC (rev
13294)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml 2009-01-27 19:03:43 UTC (rev
13295)
@@ -183,14 +183,6 @@
<event-handler
facet="jst.seam"
- type="POST_INSTALL"
- version="[1.2">
- <delegate
-
class="org.jboss.tools.seam.internal.core.project.facet.SeamFacetPostInstallDelegate">
- </delegate>
- </event-handler>
- <event-handler
- facet="jst.seam"
type="PRE_INSTALL"
version="[1.2">
<delegate
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetAbstractInstallDelegate.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetAbstractInstallDelegate.java 2009-01-27
17:46:18 UTC (rev 13294)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetAbstractInstallDelegate.java 2009-01-27
19:03:43 UTC (rev 13295)
@@ -765,6 +765,7 @@
createSeamProjectPreferenes(project, model);
EclipseResourceUtil.addNatureToProject(project, ISeamProject.NATURE_ID);
}
+
project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDataModelProvider.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDataModelProvider.java 2009-01-27
17:46:18 UTC (rev 13294)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDataModelProvider.java 2009-01-27
19:03:43 UTC (rev 13295)
@@ -12,7 +12,6 @@
import java.io.File;
import java.io.IOException;
-import java.util.HashSet;
import java.util.Set;
import org.eclipse.core.runtime.FileLocator;
Deleted:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetPostInstallDelegate.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetPostInstallDelegate.java 2009-01-27
17:46:18 UTC (rev 13294)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetPostInstallDelegate.java 2009-01-27
19:03:43 UTC (rev 13295)
@@ -1,103 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.seam.internal.core.project.facet;
-
-import java.io.File;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.project.facet.core.IDelegate;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-import org.eclipse.wst.server.core.IServer;
-import org.jboss.ide.eclipse.as.core.server.internal.JBossServer;
-import org.jboss.tools.jst.web.server.RegistrationHelper;
-
-/**
- * <p>Facet Post install delegate that handles:
- * <ul>
- * <li>JDBC driver copying to server libraries folder;
- * <li> registering faceted project on the selected server;
- * <li>deploying datasource .xml file to the selected server;
- * </ul>
- * </p>
- * @author eskimo
- *
- */
-public class SeamFacetPostInstallDelegate implements IDelegate,
ISeamFacetDataModelProperties {
- /**
- * Description
- * @param project
- * target project
- * @param fv
- * Facet version information
- * @param config
- * configuration parameters
- * @param monitor
- * progress monitor
- * @throws CoreException
- * never throws
- */
- public void execute(IProject project, IProjectFacetVersion fv, Object config,
IProgressMonitor monitor) throws CoreException {
- final IDataModel model = (IDataModel) config;
-
- IServer server = (IServer) model.getProperty(JBOSS_AS_TARGET_SERVER);
- if (server != null) {
- JBossServer jbs = (JBossServer) server.loadAdapter(JBossServer.class, new
NullProgressMonitor());
- if (jbs != null) {
- String[] driverJars = (String[])
model.getProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATH);
- String configFolder = jbs.getConfigDirectory();
- AntCopyUtils.copyFiles(driverJars, new File(configFolder, "lib"), false);
- }
-
- RegistrationHelper.runRegisterInServerJob(project, server);
-
- IPath filePath = new Path("resources").append(project.getName() +
"-ds.xml");
-
- if (!isWarConfiguration(model)) {
- IWorkspaceRoot wsRoot = ResourcesPlugin.getWorkspace().getRoot();
- IProject earProjectToBeImported = wsRoot.getProject(project.getName() +
"-ear");
- new DataSourceXmlDeployer(earProjectToBeImported, server, filePath).schedule();
- } else {
- new DataSourceXmlDeployer(project, server, filePath).schedule();
- }
- }
- }
-
- /**
- * Never used
- * @throws CoreException
- * never throws
- * @return
- * always return null
- * @see org.eclipse.wst.common.project.facet.core.IActionConfigFactory#create()
- */
- public Object create() throws CoreException {
- return null;
- }
- /**
- * Define if WAR deployment configuration is used
- * @param model
- * configuration parameters
- * @return
- * true - is Seam Project uses EAR deployment
- * false - EAR
- */
- public static boolean isWarConfiguration(IDataModel model) {
- return
"war".equals(model.getProperty(ISeamFacetDataModelProperties.JBOSS_AS_DEPLOY_AS));
//$NON-NLS-1$
- }
-
-}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamProjectCreator.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamProjectCreator.java 2009-01-27
17:46:18 UTC (rev 13294)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamProjectCreator.java 2009-01-27
19:03:43 UTC (rev 13295)
@@ -21,6 +21,7 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.resources.ProjectScope;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/META-INF/MANIFEST.MF 2009-01-27 17:46:18
UTC (rev 13294)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/META-INF/MANIFEST.MF 2009-01-27 19:03:43
UTC (rev 13295)
@@ -58,7 +58,8 @@
org.jboss.tools.jst.jsp,
org.eclipse.jst.jsf.core,
org.eclipse.ltk.core.refactoring;bundle-version="3.4.0",
- org.eclipse.ltk.ui.refactoring;bundle-version="3.4.0"
+ org.eclipse.ltk.ui.refactoring;bundle-version="3.4.0",
+ org.jboss.ide.eclipse.as.core;bundle-version="1.0.0"
Eclipse-LazyStart: true
Export-Package: org.jboss.tools.seam.ui,
org.jboss.tools.seam.ui.actions,
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamProjectWizard.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamProjectWizard.java 2009-01-27
17:46:18 UTC (rev 13294)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamProjectWizard.java 2009-01-27
19:03:43 UTC (rev 13295)
@@ -10,16 +10,24 @@
******************************************************************************/
package org.jboss.tools.seam.ui.wizard;
+import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.jst.j2ee.internal.common.classpath.J2EEComponentClasspathUpdater;
import org.eclipse.jst.servlet.ui.project.facet.WebProjectFirstPage;
import org.eclipse.jst.servlet.ui.project.facet.WebProjectWizard;
import org.eclipse.swt.SWT;
@@ -48,15 +56,21 @@
import org.eclipse.wst.common.project.facet.core.events.IFacetedProjectEvent;
import org.eclipse.wst.common.project.facet.core.events.IFacetedProjectListener;
import org.eclipse.wst.common.project.facet.core.runtime.IRuntime;
+import org.eclipse.wst.server.core.IServer;
import org.eclipse.wst.server.ui.ServerUIUtil;
+import org.jboss.ide.eclipse.as.core.server.internal.JBossServer;
+import org.jboss.tools.jst.web.server.RegistrationHelper;
import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.core.project.facet.SeamProjectPreferences;
import org.jboss.tools.seam.core.project.facet.SeamVersion;
+import org.jboss.tools.seam.internal.core.project.facet.AntCopyUtils;
+import org.jboss.tools.seam.internal.core.project.facet.DataSourceXmlDeployer;
import org.jboss.tools.seam.internal.core.project.facet.ISeamFacetDataModelProperties;
import org.jboss.tools.seam.internal.core.project.facet.Seam2ProjectCreator;
import
org.jboss.tools.seam.internal.core.project.facet.SeamFacetProjectCreationDataModelProvider;
import org.jboss.tools.seam.internal.core.project.facet.SeamProjectCreator;
import org.jboss.tools.seam.ui.ISeamHelpContextIds;
+import org.jboss.tools.seam.ui.SeamGuiPlugin;
import org.jboss.tools.seam.ui.SeamUIMessages;
import org.jboss.tools.seam.ui.internal.project.facet.SeamInstallWizardPage;
@@ -201,28 +215,81 @@
*/
protected void performFinish(final IProgressMonitor monitor) throws CoreException {
super.performFinish(monitor);
- IProject project = this.getFacetedProject().getProject();
+ // Create ear, ejb, test projects
+ IProject warProject = this.getFacetedProject().getProject();
SeamInstallWizardPage page =
(SeamInstallWizardPage)getPage(SeamUIMessages.SEAM_INSTALL_WIZARD_PAGE_SEAM_FACET);
IDataModel model = page.getConfig();
-
String seamVersionString =
model.getProperty(IFacetDataModelProperties.FACET_VERSION_STR).toString();
SeamVersion seamVersion = SeamVersion.parseFromString(seamVersionString);
SeamProjectCreator creator = null;
if(seamVersion == SeamVersion.SEAM_1_2) {
- creator = new SeamProjectCreator(model, project);
+ creator = new SeamProjectCreator(model, warProject);
} else if(seamVersion == SeamVersion.SEAM_2_0) {
- creator = new Seam2ProjectCreator(model, project);
+ creator = new Seam2ProjectCreator(model, warProject);
} else if(seamVersion == SeamVersion.SEAM_2_1) {
- creator = new Seam2ProjectCreator(model, project);
+ creator = new Seam2ProjectCreator(model, warProject);
} else {
throw new RuntimeException("Can't get seam version from seam facet
model");
}
creator.execute(monitor);
+
+ boolean deployAsEar =
ISeamFacetDataModelProperties.DEPLOY_AS_EAR.equals(model.getProperty(ISeamFacetDataModelProperties.JBOSS_AS_DEPLOY_AS));
+ IProject earProject = null;
+ IProject ejbProject = null;
+ List<IProject> projects = new ArrayList<IProject>();
+
+ // build projects. We need to build it before publishing on server.
+ if(deployAsEar) {
+ String ejbProjectName =
model.getStringProperty(ISeamFacetDataModelProperties.SEAM_EJB_PROJECT);
+ String earProjectName =
model.getStringProperty(ISeamFacetDataModelProperties.SEAM_EAR_PROJECT);
+ IWorkspaceRoot wsRoot = ResourcesPlugin.getWorkspace().getRoot();
+ earProject = wsRoot.getProject(earProjectName);
+ ejbProject = wsRoot.getProject(ejbProjectName);
+ projects.add(earProject);
+ projects.add(ejbProject);
+ }
+ projects.add(warProject);
+ buildProjects(projects, monitor);
+
+ // copy JDBC driver to server libraries folder;
+ // register project on the selected server;
+ // deploy datasource xml file to the selected server;
+
+ IServer server = (IServer)
model.getProperty(ISeamFacetDataModelProperties.JBOSS_AS_TARGET_SERVER);
+ if (server != null) {
+ JBossServer jbs = (JBossServer) server.loadAdapter(JBossServer.class, new
NullProgressMonitor());
+ if (jbs != null) {
+ String[] driverJars = (String[])
model.getProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATH);
+ String configFolder = jbs.getConfigDirectory();
+ AntCopyUtils.copyFiles(driverJars, new File(configFolder, "lib"), false);
+ }
+
+ RegistrationHelper.runRegisterInServerJob(warProject, server);
+
+ IPath filePath = new Path("resources").append(warProject.getName() +
"-ds.xml");
+
+ if (deployAsEar) {
+ new DataSourceXmlDeployer(earProject, server, filePath).schedule();
+ } else {
+ new DataSourceXmlDeployer(warProject, server, filePath).schedule();
+ }
+ }
}
- class SeamWebProjectFirstPage extends WebProjectFirstPage {
+ private void buildProjects(List<IProject> projects, IProgressMonitor monitor)
{
+ J2EEComponentClasspathUpdater.getInstance().forceUpdate(projects);
+ try {
+ for (IProject project : projects) {
+ project.build(IncrementalProjectBuilder.FULL_BUILD, monitor);
+ }
+ } catch (CoreException e) {
+ SeamGuiPlugin.getPluginLog().logError(e);
+ }
+ }
+
+ class SeamWebProjectFirstPage extends WebProjectFirstPage {
@Override
protected String getInfopopID() {
return ISeamHelpContextIds.NEW_SEAM_PROJECT;