Package org.eclipse.wst.server.core.model

Examples of org.eclipse.wst.server.core.model.IModuleFile


        addZipEntries(out, Arrays.asList(folderResources), filterInFiles);
        continue;
      }

      IModuleFile moduleFile = (IModuleFile) resource;
      // Only add files that are in the filterInList
      if (!filterInFiles.contains(moduleFile)) {
        continue;
      }

      String entryPath = getZipRelativeName(resource);

      ZipEntry zipEntry = new ZipEntry(entryPath);

      InputStream input = null;
      long timeStamp = 0;
      IFile iFile = (IFile) moduleFile.getAdapter(IFile.class);
      if (iFile != null) {
        timeStamp = iFile.getLocalTimeStamp();
        input = iFile.getContents();
      }
      else {
        File file = (File) moduleFile.getAdapter(File.class);
        timeStamp = file.lastModified();
        input = new FileInputStream(file);
      }

      if (timeStamp != IResource.NULL_STAMP && timeStamp != 0) {
View Full Code Here


        IModuleResource resource = delta.getModuleResource();
        List<IModuleResourceDelta> fileList = new ArrayList<IModuleResourceDelta>();

        if (resource instanceof IModuleFile) {
            IModuleFile moduleFile = (IModuleFile)resource;
            if (moduleFile.getName().endsWith(".jsp")) {
                fileList.add(delta);
            }
            else return null;   //not only jsp changed
        }
        else if (resource instanceof IModuleFolder) {
View Full Code Here

            //if not only Jsp files found, need to redeploy the module, so return false;
            if (partJspFiles == null) return false;
            else jspFiles.addAll(partJspFiles);
        }
            for (IModuleResourceDelta deltaModule : jspFiles) {
                IModuleFile moduleFile = (IModuleFile) deltaModule
                        .getModuleResource();

                String target;
                String relativePath = moduleFile.getModuleRelativePath()
                        .toOSString();
                if (relativePath != null && relativePath.length() != 0) {
                    target = moduleTargetPath.concat(ch).concat(relativePath)
                            .concat(ch).concat(moduleFile.getName());
                } else
                    target = moduleTargetPath.concat(ch).concat(
                            moduleFile.getName());

                File file = new File(target);
                switch (deltaModule.getKind()) {
                case IModuleResourceDelta.REMOVED:
                    if (file.exists())
                        file.delete();
                    break;
                case IModuleResourceDelta.ADDED:
                case IModuleResourceDelta.CHANGED:
                    if (!file.exists())
                        try {
                            file.createNewFile();
                        } catch (IOException e) {
                            Trace.trace(Trace.SEVERE, "can't create file "
                                    + file, e);
                            throw new CoreException(new Status(IStatus.ERROR,
                                    Activator.PLUGIN_ID, "can't create file "
                                            + file, e));
                        }

                    String rootFolder = GeronimoUtils.getVirtualComponent(
                            module).getRootFolder().getProjectRelativePath()
                            .toOSString();
                    String sourceFile = module.getProject().getFile(
                            rootFolder + ch
                                    + moduleFile.getModuleRelativePath() + ch
                                    + moduleFile.getName()).getLocation()
                            .toString();
                    try {

                        FileInputStream in = new FileInputStream(sourceFile);
                        FileOutputStream out = new FileOutputStream(file);
View Full Code Here

TOP

Related Classes of org.eclipse.wst.server.core.model.IModuleFile

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.