Package build

Source Code of build.BuildPlugIn

package build;

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;

import kameleon.plugin.PlugInInfo;
import kameleon.util.FileConstants;
import kameleon.util.IOFile;
import kameleon.util.IOObject;

public class BuildPlugIn implements FileConstants {
 
  public static void main(String[] args) {
    new BuildPlugIn() ;
  }
 
  public BuildPlugIn() {
    super() ;
    try {
      String targetZip = "C:\\Users\\Kay\\Desktop\\DokuWiki.kpl" ; //$NON-NLS-1$
      String tmpFile = "C:\\Users\\Kay\\Desktop\\tmp" //$NON-NLS-1$
      String jarFile = "C:\\Users\\Kay\\Desktop\\DokuWiki.jar" //$NON-NLS-1$
      ZipOutputStream newZip = new ZipOutputStream(new BufferedOutputStream(
          new FileOutputStream(targetZip))) ;
     
      // Add the plug-in in fo file
      newZip.putNextEntry(new ZipEntry(PLUGIN_INFO_FILE_NAME)) ;
      PlugInInfo info = BuildPlugIn.createPlugInInfo() ;
      IOObject.writeObjectToFile(tmpFile, info) ;
      InputStream src = new BufferedInputStream(new FileInputStream(tmpFile)) ;
      IOFile.copyFile(src, newZip) ;
      src.close() ;
     
      // Add the plug-in jar
      newZip.putNextEntry(new ZipEntry("DokuWiki.jar")) ;
      src = new BufferedInputStream(new FileInputStream(jarFile)) ;
      IOFile.copyFile(src, newZip) ;
      src.close() ;
      newZip.closeEntry() ;
     
      newZip.close() ;
    } catch (Exception e) {
      System.err.println("Exception while creating the plug-in.") ; //$NON-NLS-1$
      System.err.printf("Details : %s\n%s\n", e.getClass(), e.getMessage()) ; //$NON-NLS-1$
      e.printStackTrace(System.err) ;
    }// try
  }// BuildPlugIn()
 
  private static PlugInInfo createPlugInInfo() {
    PlugInInfo info = new PlugInInfo(
        "DokuWikiAnalyzer"//$NON-NLS-1$
        true,
        "DokuWiki"//$NON-NLS-1$
        "adoku.Main"//$NON-NLS-1$
        new String[]{"txt"}//$NON-NLS-1$
        "DokuWiki", null) ; //$NON-NLS-1$
    return info ;
  }// createPlugInInfo()

}// class BuildPlugIn
TOP

Related Classes of build.BuildPlugIn

TOP
Copyright © 2018 www.massapi.com. 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.