|
-
Web Project Creation
IDataModel model = DataModelFactory.createDataModel(new WebFacetProjectCreationDataModelProvider());
model.setProperty(IFacetDataModelProperties.FACET_PROJECT_NAME, "WebTest1");
FacetDataModelMap map = (FacetDataModelMap) model
.getProperty(IFacetProjectCreationDataModelProperties.FACET_DM_MAP);
IDataModel webModel = (IDataModel) map.get(IModuleConstants.JST_WEB_MODULE);
webModel.setProperty(IJ2EEModuleFacetInstallDataModelProperties.FACET_VERSION_STR, "2.4");
webModel.setBooleanProperty(IJ2EEModuleFacetInstallDataModelProperties.ADD_TO_EAR, true);
model.getDefaultOperation().execute(new NullProgressMonitor(), null);
-
Ejb Project Creation
IDataModel model = DataModelFactory.createDataModel(new EjbFacetProjectCreationDataModelProvider());
model.setProperty(IFacetDataModelProperties.FACET_PROJECT_NAME, "EJBTest1");
FacetDataModelMap map = (FacetDataModelMap) model
.getProperty(IFacetProjectCreationDataModelProperties.FACET_DM_MAP);
IDataModel ejbModel = (IDataModel) map.get(IModuleConstants.JST_EJB_MODULE);
ejbModel.setProperty(IJ2EEModuleFacetInstallDataModelProperties.FACET_VERSION_STR, "2.1");
ejbModel.setBooleanProperty(IJ2EEModuleFacetInstallDataModelProperties.ADD_TO_EAR, true);
model.getDefaultOperation().execute(new NullProgressMonitor(), null);
-
EAR Project Creation
IDataModel model = DataModelFactory.createDataModel(new EarFacetInstallDataModelProvider());
model.setProperty(IFacetDataModelProperties.FACET_PROJECT_NAME, "FooEAR");
try {
model.getDefaultOperation().execute( new NullProgressMonitor(), null);
} catch (ExecutionException e) {
e.printStackTrace();
}
-
EAR Import
IDataModel importModel = DataModelFactory.createDataModel( new EARComponentImportDataModelProvider());
String earFile = "D:\\foo\\foo.ear";
importModel.setProperty(IEARComponentImportDataModelProperties.FILE_NAME, earFile);
try {
importModel.getDefaultOperation().execute( new NullProgressMonitor(), null );
} catch (ExecutionException e) {
e.printStackTrace();
}
-
EAR Export
String earOutputName = “c:\\foo\\foo.ear";
IDataModel model = DataModelFactory.createDataModel(new EARComponentExportDataModelProvider());
model.setProperty(IEARComponentExportDataModelProperties.PROJECT_NAME,
<EAR projectName>);
model.setProperty(IEARComponentExportDataModelProperties.ARCHIVE_DESTINATION, earOutputName);
try {
model.getDefaultOperation().execute( null, null );
} catch (ExecutionException e) {
e.printStackTrace();
}
|