[jbosstools-commits] JBoss Tools SVN: r41897 - trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Tue Jun 12 14:12:11 EDT 2012


Author: akazakov
Date: 2012-06-12 14:12:11 -0400 (Tue, 12 Jun 2012)
New Revision: 41897

Modified:
   trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam23ProjectCreator.java
   trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamProjectCreator.java
Log:
https://issues.jboss.org/browse/JBIDE-12160 Seam 2 component.properties is not generated correctly

Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam23ProjectCreator.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam23ProjectCreator.java	2012-06-12 18:11:57 UTC (rev 41896)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam23ProjectCreator.java	2012-06-12 18:12:11 UTC (rev 41897)
@@ -11,6 +11,9 @@
 package org.jboss.tools.seam.internal.core.project.facet;
 
 import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.Properties;
 
 import org.apache.tools.ant.types.FilterSet;
 import org.apache.tools.ant.types.FilterSetCollection;
@@ -18,6 +21,7 @@
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.jboss.tools.seam.core.SeamCorePlugin;
 
 /**
  * @author Alexey Kazakov
@@ -67,4 +71,25 @@
 			Seam23FacetInstallDelegate.copyDBDriverToProject(earProject, model, destFolder);
 		}
 	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.jboss.tools.seam.internal.core.project.facet.SeamProjectCreator#createComponentsProperties()
+	 */
+	@Override
+	protected void createComponentsProperties() {
+		File seamGenResFolder = new File(ejbProjectFolder, "ejbModule");
+//		jndiPattern=java:app/app1-ejb/\#{ejbName}
+		String jndiPattern = "java:app/" + ejbProjectName + "/#{ejbName}";
+		Properties components = new Properties();
+		components.put("jndiPattern", jndiPattern); //$NON-NLS-1$
+		components.put("embeddedEjb", "false"); //$NON-NLS-1$ $NON-NLS-2$
+		File componentsProps = new File(seamGenResFolder, "components.properties"); //$NON-NLS-1$
+		try {
+			componentsProps.createNewFile();
+			components.store(new FileOutputStream(componentsProps), ""); //$NON-NLS-1$
+		} catch (IOException e) {
+			SeamCorePlugin.getPluginLog().logError(e);
+		}
+	}
 }
\ No newline at end of file

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	2012-06-12 18:11:57 UTC (rev 41896)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamProjectCreator.java	2012-06-12 18:12:11 UTC (rev 41897)
@@ -126,7 +126,7 @@
 	private String jbossSeamPath;
 
 	private static final Map<String,String> COMPILER_LEVEL_TO_EXEC_ENV = new HashMap<String,String>();
-    
+
     static
     {
         COMPILER_LEVEL_TO_EXEC_ENV.put( JavaCore.VERSION_1_3, "J2SE-1.3" ); //$NON-NLS-1$
@@ -150,7 +150,7 @@
 		earProjectName = model.getStringProperty(ISeamFacetDataModelProperties.SEAM_EAR_PROJECT);
 		ejbProjectName = model.getStringProperty(ISeamFacetDataModelProperties.SEAM_EJB_PROJECT);
 		testProjectName = model.getStringProperty(ISeamFacetDataModelProperties.SEAM_TEST_PROJECT);
-		
+
 		seamRuntime = SeamRuntimeManager.getInstance().findRuntimeByName(model.getProperty(ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME).toString());
 		if(seamRuntime==null) {
 			throw new RuntimeException("Can't get seam runtime " + model.getProperty(ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME).toString());
@@ -163,7 +163,7 @@
 		filtersFilterSet =  SeamFacetFilterSetFactory.createFiltersFilterSet(model);
 		seamGenResFolder = new File(seamGenHomeFolder, "resources"); //$NON-NLS-1$
 		persistenceFile = new File(seamGenResFolder, "META-INF/persistence-" + (SeamFacetAbstractInstallDelegate.isWarConfiguration(model) ? DEV_WAR_PROFILE : DEV_EAR_PROFILE) + ".xml"); //$NON-NLS-1$ //$NON-NLS-2$
-		
+
 		try {
 			hibernateConsoleLaunchFile = new File(SeamFacetInstallDataModelProvider.getTemplatesFolder(), "hibernatetools/hibernate-console.launch");
 		} catch (IOException e) {
@@ -274,7 +274,7 @@
 				});
 				StringBuffer earJarsStrWar = new StringBuffer();
 				StringBuffer earJarsStrEjb = new StringBuffer();
-				
+
 				if(earJars != null){
 					for (File file : earJars) {
 						earJarsStrWar.append(" ").append(file.getName()).append(" \n");
@@ -293,7 +293,7 @@
 				FilterSet manifestFilterWar = new FilterSet();
 				manifestFilterWar.addFilter("earLibs", earJarsStrWar.toString()); //$NON-NLS-1$
 				manifestFilterColWar.addFilterSet(manifestFilterWar);
-				
+
 				if(shouldCopyLibrariesAndTemplates(model))
 					AntCopyUtils.copyFileToFolder(new File(SeamFacetInstallDataModelProvider.getTemplatesFolder(), "war/META-INF/MANIFEST.MF"), webMetaInf, manifestFilterColWar, true); //$NON-NLS-1$
 
@@ -301,7 +301,7 @@
 				FilterSet manifestFilterEjb = new FilterSet();
 				manifestFilterEjb.addFilter("earClasspath", earJarsStrEjb.toString()); //$NON-NLS-1$
 				manifestFilterColEjb.addFilterSet(manifestFilterEjb);
-				
+
 				if(shouldCopyLibrariesAndTemplates(model))
 					AntCopyUtils.copyFileToFolder(new File(SeamFacetInstallDataModelProvider.getTemplatesFolder(), "ejb/ejbModule/META-INF/MANIFEST.MF"), ejbMetaInf, manifestFilterColEjb, true); //$NON-NLS-1$
 			} catch (IOException e) {
@@ -559,7 +559,7 @@
 	protected void createEjbProject() {
 		if(!shouldCopyLibrariesAndTemplates(model))
 			return;
-		
+
 		ejbProjectFolder.mkdir();
 
 		AntCopyUtils.copyFilesAndFolders(
@@ -579,7 +579,7 @@
 			new File(ejbProjectFolder, "ejbModule/META-INF/persistence.xml"), //$NON-NLS-1$
 			viewFilterSetCollection, true);
 
-		SeamFacetAbstractInstallDelegate.createComponentsProperties(new File(ejbProjectFolder, "ejbModule"), earProjectName, false); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+		createComponentsProperties();
 
 		AntCopyUtils.FileSet ejbSrcResourcesSet = new AntCopyUtils.FileSet(SeamFacetAbstractInstallDelegate.JBOOS_EJB_WEB_INF_CLASSES_SET).dir(seamGenResFolder);
 		AntCopyUtils.copyFilesAndFolders(
@@ -603,7 +603,6 @@
 
 		ejbFilterSet.addFilter("connectionProfile", model.getStringProperty(ISeamFacetDataModelProperties.SEAM_CONNECTION_PROFILE));//$NON-NLS-1$
 
-		
 		AntCopyUtils.copyFileToFile(
 				hibernateConsoleLaunchFile,
 				new File(ejbProjectFolder, getLaunchCfgName(ejbProjectFolder.getName()) + ".launch"),  //$NON-NLS-1$
@@ -614,7 +613,11 @@
 			ejbProjectFolder,
 			hibernateDialectFilterSet, true);
 	}
-	
+
+	protected void createComponentsProperties() {
+		SeamFacetAbstractInstallDelegate.createComponentsProperties(new File(ejbProjectFolder, "ejbModule"), earProjectName, false); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+	}
+
 	protected String getLaunchCfgName(String baseName){
 		ILaunchManager lm = DebugPlugin.getDefault().getLaunchManager();
 		return lm.generateUniqueLaunchConfigurationNameFrom(baseName);
@@ -636,7 +639,7 @@
 	protected void createEarProject() {
 		if(!shouldCopyLibrariesAndTemplates(model))
 			return;
-		
+
 		earProjectFolder.mkdir();
 
 		File earContentsFolder = new File(earProjectFolder, "EarContent"); //$NON-NLS-1$
@@ -652,7 +655,7 @@
 		} catch (IOException e) {
 			SeamCorePlugin.getPluginLog().logError(e);
 		}
-	
+
 		// Fill ear contents
 		AntCopyUtils.copyFiles(seamHomeFolder, earContentsFolder, new AntCopyUtils.FileSetFileFilter(new AntCopyUtils.FileSet(getJbossEarContent()).dir(seamHomeFolder)));
 		if (!SeamCorePlugin.getDefault().hasM2Facet(seamWebProject) && shouldCopyLibraries(model)) {
@@ -712,11 +715,11 @@
 			SeamCorePlugin.getPluginLog().logError(e);
 		}
 	}
-	
+
 	protected void configureJBossAppXml() {
 		// Do nothing special for Seam 1.2
 	}
-	
+
 	protected boolean shouldCopyLibrariesAndTemplates(IDataModel model){
 		return model.getBooleanProperty(ISeamFacetDataModelProperties.SEAM_TEMPLATES_AND_LIBRARIES_COPYING);
 	}



More information about the jbosstools-commits mailing list