Package org.eclipse.wst.common.frameworks.datamodel

Examples of org.eclipse.wst.common.frameworks.datamodel.IDataModel


public class ClickFacetInstallDelegate implements IDelegate {

  public void execute(IProject project, IProjectFacetVersion fv,
      Object cfg, IProgressMonitor monitor) throws CoreException {
    try {
      IDataModel config = null;
      if (cfg != null) {
        config = (IDataModel) cfg;
      }

      if (monitor != null) {
        int totalTasks = 3;
        if(config.getBooleanProperty(ClickFacetInstallDataModelProvider.USE_SPRING)){
          totalTasks++;
        }
        if(config.getBooleanProperty(ClickFacetInstallDataModelProvider.USE_CAYENNE)){
          totalTasks++;
        }
        monitor.beginTask("", totalTasks); //$NON-NLS-1$
      }

      // Add Click JARs to WEB-INF/lib
      deployClickFiles(project, config, monitor);

      // Update web model
      createServletAndModifyWebXML(project, config, monitor,
          config.getBooleanProperty(ClickFacetInstallDataModelProvider.USE_SPRING),
          config.getBooleanProperty(ClickFacetInstallDataModelProvider.USE_CAYENNE),
          config.getBooleanProperty(ClickFacetInstallDataModelProvider.USE_PERFORMANCE_FILTER));

      if (monitor != null) {
        monitor.worked(1);
      }

      // Add the nature
      ClickProjectNature.addNatute(project);

      if (monitor != null) {
        monitor.worked(1);
      }

      // Disable HTML validator
      try {
        MutableWorkspaceSettings globalSettings = ValidationFramework.getDefault().getWorkspaceSettings();

        List<IMutableValidator> mvs = new ArrayList<IMutableValidator>();
        for(IMutableValidator mv: globalSettings.getValidators()){
          if(mv.getId().equals("org.eclipse.wst.html.ui.HTMLValidator")){
            mv.setBuildValidation(false);
            mv.setManualValidation(false);
          }
          mvs.add(mv);
        }

        MutableProjectSettings projectSettings = new MutableProjectSettings(
            project, mvs.toArray(new IMutableValidator[mvs.size()]));
        projectSettings.setOverride(true);

        ValidationFramework.getDefault().applyChanges(projectSettings, true);

      } catch(Exception ex){
        //ex.printStackTrace();
      }
      if (monitor != null) {
        monitor.worked(1);
      }

      // Install Spring
      if(config.getBooleanProperty(ClickFacetInstallDataModelProvider.USE_SPRING)){
        deploySpringFiles(project, config, monitor);
        if (monitor != null) {
          monitor.worked(1);
        }
      }

      // Install Cayenne
      if(config.getBooleanProperty(ClickFacetInstallDataModelProvider.USE_CAYENNE)){
        deployCayenneFiles(project, config, monitor);
        if (monitor != null) {
          monitor.worked(1);
        }
      }
View Full Code Here


public class ClickFacetUninstallDelegate implements IDelegate {

  public void execute(IProject project, IProjectFacetVersion fv,
      Object config, IProgressMonitor monitor) throws CoreException {

    IDataModel dataModel = (IDataModel) config;

    if (monitor != null) {
      monitor.beginTask("", 3); //$NON-NLS-1$
    }
View Full Code Here

      System.out.println("Building project '" + projectName + "'...");
      IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
      project.build(IncrementalProjectBuilder.FULL_BUILD, null);

      System.out.println("Exporting to WAR...");
      IDataModel dataModel = DataModelFactory.createDataModel(new WebComponentExportDataModelProvider());
      dataModel.setProperty(IJ2EEComponentExportDataModelProperties.PROJECT_NAME, projectName);
      dataModel.setProperty(IJ2EEComponentExportDataModelProperties.ARCHIVE_DESTINATION, destFile);

      dataModel.getDefaultOperation().execute(null, null);
      System.out.println("Done.");
    }
    return status;
  }
View Full Code Here

      System.out.println("Building project '"+projectName+"'...");
      IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
      project.build(IncrementalProjectBuilder.FULL_BUILD, null);
     
      System.out.println("Exporting to WAR...");
      IDataModel dataModel = DataModelFactory.createDataModel(new WebComponentExportDataModelProvider() );
      dataModel.setProperty(IJ2EEComponentExportDataModelProperties.PROJECT_NAME, projectName);
      dataModel.setProperty(IJ2EEComponentExportDataModelProperties.ARCHIVE_DESTINATION, destFile);
     
      dataModel.getDefaultOperation().execute(null, null);
      System.out.println("Done.");
    }
    return status;
  }
View Full Code Here

    // need to be reviewed.
    Assert.assertEquals(1, facets.size());
    IProjectFacet facet = facets.iterator().next();

    // Creates the data model for configuring the facet.
    IDataModel config = DataModelFactory
        .createDataModel(new SimpleWebFacetProjectCreationDataModelProvider());

    config = initConfig(config, facet.getDefaultVersion(),
        IFacetedProject.Action.Type.INSTALL, projectName);
View Full Code Here

  private static IDataModel initConfig(IDataModel model,
      IProjectFacetVersion fv, Type type, String pjname)
      throws CoreException {
    FacetDataModelMap map = (FacetDataModelMap) model
        .getProperty(IFacetProjectCreationDataModelProperties.FACET_DM_MAP);
    IDataModel configDM = (IDataModel) map
        .get(fv.getProjectFacet().getId());
    if (configDM == null) {
      final Object config = fv.createActionConfig(type, pjname);
      if (config == null || !(config instanceof IDataModel)) {
        return null;
      }
      configDM = (IDataModel) config;
      map.add(configDM);
    }

    configDM.setProperty(IFacetDataModelProperties.FACET_VERSION, fv);

    return configDM;
  }
View Full Code Here

                {
                    public void propertyChanged( final String property,
                                                 final Object oldValue,
                                                 final Object newValue )
                    {
                        final IDataModel dm = getDataModel();
   
                        if( dm != null )
                        {
                            dm.notifyPropertyChange( LIBRARY_PROVIDER_DELEGATE, IDataModel.VALUE_CHG );
                        }
                    }
                }
            );
        }
View Full Code Here

   
    IFacetedProjectWorkingCopy projWC = (IFacetedProjectWorkingCopy)getProperty(FACETED_PROJECT_WORKING_COPY);
    Set<Action> pfas = projWC.getProjectFacetActions();
    for (Action action : pfas){
      if (action.getProjectFacetVersion().getProjectFacet().getId().equals("jst.web")){ //$NON-NLS-1$
        IDataModel webFacet = (IDataModel) action.getConfig();
        return webFacet.getStringProperty(IJ2EEModuleFacetInstallDataModelProperties.CONFIG_FOLDER );
      }
    }
   
    //should not get here.  
    return null;
View Full Code Here

    if (monitor != null) {
      monitor.beginTask("", 1); //$NON-NLS-1$
    }

    try {
      IDataModel config = null;

      if (cfg != null) {
        config = (IDataModel) cfg;
      } else {
        throw new JSFFacetException(           
                Messages.JSFFacetInstallDelegate_InternalErr);
      }

            final JSFUtils jsfUtil = new JSFUtilFactory().create(fv, ModelProviderManager.getModelProvider(project));
            if (jsfUtil == null)
            {
                throw new JSFFacetException(NLS.bind(
                        Messages.Could_Not_GetJSFVersion, fv.toString()));
            }

            if (jsfFacetConfigurationEnabled)
            {
                // Before we do any configuration, verify that web.xml is                    // available for update
                final IModelProvider provider = jsfUtil
                        .getModelProvider();
                if (provider == null)
                {
                    throw new JSFFacetException(NLS.bind(
                            Messages.JSFFacetInstallDelegate_ConfigErr,
                            project.getName()));
                }
                else if (!(provider.validateEdit(null, null).isOK()))
                {
                    if (!(provider.validateEdit(null, null).isOK()))
                    {// checks for web.xml file being read-only and allows
                     // user to set writeable
                        throw new JSFFacetException(
                                NLS.bind(
                                        Messages.JSFFacetInstallDelegate_NonUpdateableWebXML,
                                        project.getName()));
                    }
                }
            }
     
//      // Create JSF Libs as classpath containers and set WTP dependencies
//      // as required
//      createClasspathEntries(project, fv, config, monitor);
     
      //Configure libraries
      ( (LibraryInstallDelegate) config.getProperty( IJSFFacetInstallDataModelProperties.LIBRARY_PROVIDER_DELEGATE ) ).execute( new NullProgressMonitor() );

          final LibraryInstallDelegate libDelegate = (LibraryInstallDelegate) (config.getProperty( IJSFFacetInstallDataModelProperties.LIBRARY_PROVIDER_DELEGATE));
          final LibraryProviderOperationConfig libConfig = libDelegate.getLibraryProviderOperationConfig();

      if (jsfFacetConfigurationEnabled)
            {
          // Create config file
          createConfigFile(project, fv, config, monitor, jsfUtil);

          final Boolean configureServlet = (Boolean) config.getProperty(IJSFFacetInstallDataModelProperties.CONFIGURE_SERVLET);
          if (configureServlet == null || configureServlet.booleanValue()) {
            // Update web model
            createServletAndModifyWebXML(project, config, monitor, jsfUtil);
                  updateWebXmlByJsfVendor(libConfig, project, monitor);
          }
View Full Code Here

                {
                    public void propertyChanged( final String property,
                                                 final Object oldValue,
                                                 final Object newValue )
                    {
                        final IDataModel dm = getDataModel();
   
                        if( dm != null )
                        {
                            dm.notifyPropertyChange( LIBRARY_PROVIDER_DELEGATE, IDataModel.VALUE_CHG );
                        }
                    }
                }
            );
        }
View Full Code Here

TOP

Related Classes of org.eclipse.wst.common.frameworks.datamodel.IDataModel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.