org.tizen.web.builder_2.0.0.201310251448

16:50:33.284 INFO  jd.cli.Main - Decompiling org.tizen.web.builder_2.0.0.201310251448.jar
package org.tizen.web.builder;

import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;

class ConfigurationParserHandler
  extends DefaultHandler
{
  private final String APP_ELEMENT = "tizen:application";
  private static final String PKG_ATTRIBUTE = "package";
  protected String pkgID = null;
  
  public void startElement(String uri, String localName, String qName, Attributes attributes)
    throws SAXException
  {
    if (qName.equalsIgnoreCase("tizen:application")) {
      pkgID = attributes.getValue("package");
    }
    super.startElement(uri, localName, qName, attributes);
  }
  
  public String getPkgID()
  {
    return pkgID;
  }
}

/* Location:
 * Qualified Name:     org.tizen.web.builder.ConfigurationParserHandler
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.web.builder;

import java.io.IOException;
import org.slf4j.Logger;
import org.tizen.common.FactoryWithArgument;
import org.tizen.common.builder.Resource;
import org.tizen.common.builder.ResourceLayer;
import org.tizen.common.builder.core.AbstractBuilder;
import org.tizen.common.file.FileHandler;
import org.tizen.common.file.FileHandler.Attribute;
import org.tizen.common.file.Filter;
import org.tizen.common.file.SimpleFileFilter;
import org.tizen.common.file.filter.WildCardFilterFactory;
import org.tizen.web.compressor.minifier.core.CSSMinifier;

public class CssMinifyBuilder
  extends AbstractBuilder
{
  public static final String RESOURCE_LAYER_NAME = "css minify layer";
  private SimpleFileFilter filter = new SimpleFileFilter(true);
  private FactoryWithArgument<Filter, String> filterFactory = new WildCardFilterFactory();
  CSSMinifier cssMin = new CSSMinifier();
  
  public CssMinifyBuilder(ResourceLayer resourceLayer)
  {
    super(resourceLayer);
  }
  
  public boolean canBuild(Resource resource)
  {
    if (resource == null) {
      return false;
    }
    FileHandler fh = resource.getFileHandler();
    String path = resource.getPath();
    try
    {
      if (!fh.is(path, FileHandler.Attribute.EXISTS)) {
        return false;
      }
    }
    catch (IOException localIOException)
    {
      return false;
    }
    if (!filter.accept(null, path))
    {
      logger.debug("Ignore {}", path);
      return false;
    }
    return cssMin.canHandle(resource.getPath());
  }
  
  /* Error */
  public org.tizen.common.builder.BuildResult build(Resource resource)
    throws org.tizen.common.builder.exception.BuildException
  {
    // Byte code:
    //   0: aconst_null
    //   1: astore_2
    //   2: aconst_null
    //   3: astore_3
    //   4: aload_1
    //   5: invokevirtual 107	org/tizen/common/builder/Resource:getContents	()Ljava/io/InputStream;
    //   8: astore_2
    //   9: new 111	java/io/ByteArrayOutputStream
    //   12: dup
    //   13: invokespecial 113	java/io/ByteArrayOutputStream:<init>	()V
    //   16: astore_3
    //   17: aload_0
    //   18: getfield 76	org/tizen/web/builder/CssMinifyBuilder:logger	Lorg/slf4j/Logger;
    //   21: ldc 114
    //   23: aload_1
    //   24: invokevirtual 56	org/tizen/common/builder/Resource:getPath	()Ljava/lang/String;
    //   27: invokeinterface 82 3 0
    //   32: aload_0
    //   33: getfield 40	org/tizen/web/builder/CssMinifyBuilder:cssMin	Lorg/tizen/web/compressor/minifier/core/CSSMinifier;
    //   36: aload_2
    //   37: aload_3
    //   38: invokevirtual 116	org/tizen/web/compressor/minifier/core/CSSMinifier:compress	(Ljava/io/InputStream;Ljava/io/OutputStream;)V
    //   41: aload_0
    //   42: getfield 120	org/tizen/web/builder/CssMinifyBuilder:layer	Lorg/tizen/common/builder/ResourceLayer;
    //   45: aload_1
    //   46: invokevirtual 56	org/tizen/common/builder/Resource:getPath	()Ljava/lang/String;
    //   49: aload_3
    //   50: invokevirtual 123	java/io/ByteArrayOutputStream:toByteArray	()[B
    //   53: invokevirtual 127	org/tizen/common/builder/ResourceLayer:addResource	(Ljava/lang/String;[B)Lorg/tizen/common/builder/Resource;
    //   56: astore 4
    //   58: new 133	org/tizen/common/builder/BuildResult
    //   61: dup
    //   62: invokespecial 135	org/tizen/common/builder/BuildResult:<init>	()V
    //   65: astore 5
    //   67: aload 5
    //   69: aload_1
    //   70: aload 4
    //   72: invokevirtual 136	org/tizen/common/builder/BuildResult:addDependency	(Lorg/tizen/common/builder/Resource;Lorg/tizen/common/builder/Resource;)V
    //   75: aload 5
    //   77: astore 7
    //   79: iconst_2
    //   80: anewarray 140	java/lang/Object
    //   83: dup
    //   84: iconst_0
    //   85: aload_2
    //   86: aastore
    //   87: dup
    //   88: iconst_1
    //   89: aload_3
    //   90: aastore
    //   91: invokestatic 142	org/tizen/common/util/IOUtil:tryClose	([Ljava/lang/Object;)V
    //   94: aload 7
    //   96: areturn
    //   97: astore 4
    //   99: new 148	org/tizen/web/builder/exception/MinifyException
    //   102: dup
    //   103: aload_1
    //   104: invokevirtual 56	org/tizen/common/builder/Resource:getPath	()Ljava/lang/String;
    //   107: aload 4
    //   109: invokevirtual 150	org/mozilla/javascript/EvaluatorException:lineNumber	()I
    //   112: aload 4
    //   114: invokevirtual 156	org/mozilla/javascript/EvaluatorException:columnNumber	()I
    //   117: aload 4
    //   119: invokevirtual 159	org/mozilla/javascript/EvaluatorException:lineSource	()Ljava/lang/String;
    //   122: aload 4
    //   124: invokespecial 162	org/tizen/web/builder/exception/MinifyException:<init>	(Ljava/lang/String;IILjava/lang/String;Ljava/lang/Throwable;)V
    //   127: athrow
    //   128: astore 4
    //   130: new 105	org/tizen/common/builder/exception/BuildException
    //   133: dup
    //   134: aload 4
    //   136: invokespecial 165	org/tizen/common/builder/exception/BuildException:<init>	(Ljava/lang/Throwable;)V
    //   139: athrow
    //   140: astore 6
    //   142: iconst_2
    //   143: anewarray 140	java/lang/Object
    //   146: dup
    //   147: iconst_0
    //   148: aload_2
    //   149: aastore
    //   150: dup
    //   151: iconst_1
    //   152: aload_3
    //   153: aastore
    //   154: invokestatic 142	org/tizen/common/util/IOUtil:tryClose	([Ljava/lang/Object;)V
    //   157: aload 6
    //   159: athrow
    // Line number table:
    //   Java source line #84	-> byte code offset #0
    //   Java source line #85	-> byte code offset #2
    //   Java source line #88	-> byte code offset #4
    //   Java source line #89	-> byte code offset #9
    //   Java source line #91	-> byte code offset #17
    //   Java source line #92	-> byte code offset #32
    //   Java source line #94	-> byte code offset #41
    //   Java source line #96	-> byte code offset #58
    //   Java source line #98	-> byte code offset #67
    //   Java source line #100	-> byte code offset #75
    //   Java source line #105	-> byte code offset #79
    //   Java source line #106	-> byte code offset #85
    //   Java source line #100	-> byte code offset #94
    //   Java source line #101	-> byte code offset #97
    //   Java source line #102	-> byte code offset #99
    //   Java source line #103	-> byte code offset #128
    //   Java source line #104	-> byte code offset #130
    //   Java source line #105	-> byte code offset #140
    //   Java source line #106	-> byte code offset #148
    //   Java source line #107	-> byte code offset #157
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	160	0	this	CssMinifyBuilder
    //   0	160	1	resource	Resource
    //   1	148	2	is	java.io.InputStream
    //   3	150	3	os	java.io.ByteArrayOutputStream
    //   56	15	4	out	Resource
    //   97	26	4	e	org.mozilla.javascript.EvaluatorException
    //   128	7	4	e	IOException
    //   65	11	5	ret	org.tizen.common.builder.BuildResult
    //   140	18	6	localObject	Object
    //   77	18	7	localBuildResult1	org.tizen.common.builder.BuildResult
    // Exception table:
    //   from	to	target	type
    //   4	79	97	org/mozilla/javascript/EvaluatorException
    //   4	79	128	java/io/IOException
    //   4	79	140	finally
    //   97	140	140	finally
  }
  
  public void setExcludes(String[] excludes)
  {
    filter.clearExcludes();
    if (excludes != null)
    {
      String[] arrayOfString;
      int j = (arrayOfString = excludes).length;
      for (int i = 0; i < j; i++)
      {
        String exclude = arrayOfString[i];
        filter.addExcludes(new Filter[] { (Filter)filterFactory.create(exclude) });
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.tizen.web.builder.CssMinifyBuilder
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.web.builder;

import com.googlecode.htmlcompressor.compressor.HtmlCompressor;
import java.io.IOException;
import org.tizen.common.builder.BuildResult;
import org.tizen.common.builder.Resource;
import org.tizen.common.builder.ResourceLayer;
import org.tizen.common.builder.core.AbstractBuilder;
import org.tizen.common.builder.exception.BuildException;
import org.tizen.common.util.IOUtil;

public class HtmlMinifier
  extends AbstractBuilder
{
  protected final HtmlCompressor compressor = new HtmlCompressor();
  
  public HtmlMinifier()
  {
    this(null);
  }
  
  public HtmlMinifier(ResourceLayer layer)
  {
    super(layer);
  }
  
  public boolean canBuild(Resource resource)
  {
    try
    {
      String name = resource.getName();
      if ((name.endsWith(".html")) || (name.endsWith(".htm"))) {
        return true;
      }
      return false;
    }
    catch (IOException localIOException) {}
    return false;
  }
  
  public BuildResult build(Resource resource)
    throws BuildException
  {
    try
    {
      BuildResult result = new BuildResult();
      
      layer.addResource(resource.getPath(), compressor.compress(IOUtil.getString(resource.getContents())).getBytes());
      
      return result;
    }
    catch (IOException e)
    {
      throw new BuildException(e);
    }
  }
}

/* Location:
 * Qualified Name:     org.tizen.web.builder.HtmlMinifier
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.web.builder;

import java.io.IOException;
import java.io.InputStream;
import javax.xml.parsers.ParserConfigurationException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.tizen.common.TizenPlatformConstants;
import org.tizen.common.builder.BuildResult;
import org.tizen.common.builder.Resource;
import org.tizen.common.builder.ResourceLayer;
import org.tizen.common.builder.core.AbstractBuilder;
import org.tizen.common.builder.exception.BuildException;
import org.tizen.common.file.FileHandler;
import org.tizen.common.file.FileHandler.Attribute;
import org.tizen.common.file.FileHandler.Type;
import org.tizen.common.util.Assert;
import org.tizen.common.util.FilenameUtil;
import org.tizen.common.util.IOUtil;
import org.xml.sax.SAXException;

public class HybridAppCLIBuilder
  extends AbstractBuilder
{
  protected final Logger logger = LoggerFactory.getLogger(getClass());
  public static final String RESOURCE_LAYER_NAME = "Hybrid CLI Resource Layer";
  public static final String RESOURCE_LAYER_REFERENCE_NAME = "Hybrid CLI Referenced Resource Layer";
  public static final String ERROR_PKG_ID_NOT_FOUND = "Couldn't find a package ID in the widget configuration file(config.xml).";
  public static final String ERROR_CONFIG_NOT_FOUND = "Couldn't find the widget configuration file(config.xml) in your project.";
  public static final String ERROR_MANIFEST_NOT_FOUND = "Couldn't find the manifest file(manifest.xml) in the referenced project.";
  public static final String ERROR_BINARY_NOT_FOUND = "Couldn't find the binary file. Please make sure if your referenced native project is built successfully.";
  private static final String OSP_FOLDER_MANIFEST = "info";
  private static final String OSP_FOLDER_BINARY = "bin";
  private static final String OSP_FOLDER_RESOURCE = "res";
  private static final String[] OSP_MOVABLE_FOLDER = {
    "shared", "setting", "data", "icons", "lib", "llvm", "res" };
  public static final String[] OSP_BINARY_FOLDER = { "bin", "Debug", "Release", "CommandLineBuild" };
  private static final String OSP_MANIFEST = TizenPlatformConstants.MANIFEST_XML_FILE_NAME;
  private static final String APPID_ELEMENT_NAME = "Id";
  private static final String APPID_OPEN_ELEMENT = "<Id>";
  private static final String APPID_CLOSE_ELEMENT = "</Id>";
  protected String refProjectWorkingDir;
  protected boolean binaryFound = false;
  protected boolean manifestFound = false;
  
  public HybridAppCLIBuilder(ResourceLayer layer, String refpwd)
  {
    super(layer);
    
    Assert.notNull(refpwd);
    
    refProjectWorkingDir = refpwd;
    logger.trace("Referenced project working directory : {}", refProjectWorkingDir);
  }
  
  public boolean canBuild(Resource resource)
  {
    return true;
  }
  
  /* Error */
  public BuildResult build(Resource resource)
    throws BuildException
  {
    // Byte code:
    //   0: new 142	org/tizen/common/builder/BuildResult
    //   3: dup
    //   4: invokespecial 144	org/tizen/common/builder/BuildResult:<init>	()V
    //   7: astore_2
    //   8: aload_1
    //   9: invokevirtual 146	org/tizen/common/builder/Resource:getPath	()Ljava/lang/String;
    //   12: invokestatic 152	org/tizen/common/util/FilenameUtil:getCanonicalForm	(Ljava/lang/String;)Ljava/lang/String;
    //   15: astore_3
    //   16: aload_3
    //   17: invokestatic 158	org/tizen/common/util/FilenameUtil:getCanonicalFragments	(Ljava/lang/String;)[Ljava/lang/String;
    //   20: astore 4
    //   22: aload 4
    //   24: iconst_0
    //   25: aaload
    //   26: astore 5
    //   28: aconst_null
    //   29: astore 6
    //   31: aload_1
    //   32: invokevirtual 162	org/tizen/common/builder/Resource:getContents	()Ljava/io/InputStream;
    //   35: astore 6
    //   37: aload_1
    //   38: invokevirtual 166	org/tizen/common/builder/Resource:getLayer	()Lorg/tizen/common/builder/ResourceLayer;
    //   41: astore 7
    //   43: ldc 13
    //   45: aload 7
    //   47: invokevirtual 170	org/tizen/common/builder/ResourceLayer:getName	()Ljava/lang/String;
    //   50: invokevirtual 175	java/lang/String:equals	(Ljava/lang/Object;)Z
    //   53: ifne +34 -> 87
    //   56: ldc 34
    //   58: ldc -77
    //   60: invokestatic 181	org/tizen/common/util/FileUtil:appendPath	(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
    //   63: astore 8
    //   65: aload 8
    //   67: aload_3
    //   68: invokestatic 181	org/tizen/common/util/FileUtil:appendPath	(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
    //   71: astore 8
    //   73: aload_0
    //   74: aload_1
    //   75: aload 8
    //   77: aload 6
    //   79: aload_2
    //   80: invokevirtual 187	org/tizen/web/builder/HybridAppCLIBuilder:addResource	(Lorg/tizen/common/builder/Resource;Ljava/lang/String;Ljava/io/InputStream;Lorg/tizen/common/builder/BuildResult;)Lorg/tizen/common/builder/Resource;
    //   83: pop
    //   84: goto +158 -> 242
    //   87: aload 4
    //   89: arraylength
    //   90: iconst_1
    //   91: if_icmple +78 -> 169
    //   94: aload 4
    //   96: iconst_1
    //   97: aaload
    //   98: astore 8
    //   100: aload_0
    //   101: aload 5
    //   103: invokevirtual 191	org/tizen/web/builder/HybridAppCLIBuilder:isMovableFolder	(Ljava/lang/String;)Z
    //   106: ifeq +16 -> 122
    //   109: aload_0
    //   110: aload_1
    //   111: aload_3
    //   112: aload 6
    //   114: aload_2
    //   115: invokevirtual 187	org/tizen/web/builder/HybridAppCLIBuilder:addResource	(Lorg/tizen/common/builder/Resource;Ljava/lang/String;Ljava/io/InputStream;Lorg/tizen/common/builder/BuildResult;)Lorg/tizen/common/builder/Resource;
    //   118: pop
    //   119: goto +123 -> 242
    //   122: aload_0
    //   123: aload 5
    //   125: invokevirtual 195	org/tizen/web/builder/HybridAppCLIBuilder:isBinaryFolder	(Ljava/lang/String;)Z
    //   128: ifeq +114 -> 242
    //   131: aload_0
    //   132: aload_1
    //   133: aload 8
    //   135: invokevirtual 198	org/tizen/web/builder/HybridAppCLIBuilder:isBinaryFile	(Lorg/tizen/common/builder/Resource;Ljava/lang/String;)Z
    //   138: ifeq +104 -> 242
    //   141: ldc 31
    //   143: aload 8
    //   145: invokestatic 181	org/tizen/common/util/FileUtil:appendPath	(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
    //   148: astore 9
    //   150: aload_0
    //   151: aload_1
    //   152: aload 9
    //   154: aload 6
    //   156: aload_2
    //   157: invokevirtual 187	org/tizen/web/builder/HybridAppCLIBuilder:addResource	(Lorg/tizen/common/builder/Resource;Ljava/lang/String;Ljava/io/InputStream;Lorg/tizen/common/builder/BuildResult;)Lorg/tizen/common/builder/Resource;
    //   160: pop
    //   161: aload_0
    //   162: iconst_1
    //   163: putfield 108	org/tizen/web/builder/HybridAppCLIBuilder:binaryFound	Z
    //   166: goto +76 -> 242
    //   169: aload_0
    //   170: aload 5
    //   172: invokevirtual 202	org/tizen/web/builder/HybridAppCLIBuilder:isManifestFile	(Ljava/lang/String;)Z
    //   175: ifeq +67 -> 242
    //   178: ldc 28
    //   180: aload_3
    //   181: invokestatic 181	org/tizen/common/util/FileUtil:appendPath	(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
    //   184: astore 8
    //   186: aload_0
    //   187: aload 6
    //   189: invokevirtual 205	org/tizen/web/builder/HybridAppCLIBuilder:synchronizeAppID	(Ljava/io/InputStream;)[B
    //   192: astore 9
    //   194: aload_0
    //   195: aload_1
    //   196: aload 8
    //   198: aload 9
    //   200: aload_2
    //   201: invokevirtual 209	org/tizen/web/builder/HybridAppCLIBuilder:addResource	(Lorg/tizen/common/builder/Resource;Ljava/lang/String;[BLorg/tizen/common/builder/BuildResult;)Lorg/tizen/common/builder/Resource;
    //   204: pop
    //   205: aload_0
    //   206: iconst_1
    //   207: putfield 110	org/tizen/web/builder/HybridAppCLIBuilder:manifestFound	Z
    //   210: goto +32 -> 242
    //   213: astore 7
    //   215: new 140	org/tizen/common/builder/exception/BuildException
    //   218: dup
    //   219: aload 7
    //   221: invokespecial 212	org/tizen/common/builder/exception/BuildException:<init>	(Ljava/lang/Throwable;)V
    //   224: athrow
    //   225: astore 10
    //   227: iconst_1
    //   228: anewarray 95	java/lang/Object
    //   231: dup
    //   232: iconst_0
    //   233: aload 6
    //   235: aastore
    //   236: invokestatic 215	org/tizen/common/util/IOUtil:tryClose	([Ljava/lang/Object;)V
    //   239: aload 10
    //   241: athrow
    //   242: iconst_1
    //   243: anewarray 95	java/lang/Object
    //   246: dup
    //   247: iconst_0
    //   248: aload 6
    //   250: aastore
    //   251: invokestatic 215	org/tizen/common/util/IOUtil:tryClose	([Ljava/lang/Object;)V
    //   254: aload_2
    //   255: areturn
    // Line number table:
    //   Java source line #102	-> byte code offset #0
    //   Java source line #104	-> byte code offset #8
    //   Java source line #105	-> byte code offset #16
    //   Java source line #106	-> byte code offset #22
    //   Java source line #108	-> byte code offset #28
    //   Java source line #110	-> byte code offset #31
    //   Java source line #112	-> byte code offset #37
    //   Java source line #114	-> byte code offset #43
    //   Java source line #116	-> byte code offset #56
    //   Java source line #117	-> byte code offset #65
    //   Java source line #118	-> byte code offset #73
    //   Java source line #121	-> byte code offset #87
    //   Java source line #122	-> byte code offset #94
    //   Java source line #124	-> byte code offset #100
    //   Java source line #125	-> byte code offset #109
    //   Java source line #126	-> byte code offset #122
    //   Java source line #127	-> byte code offset #141
    //   Java source line #128	-> byte code offset #150
    //   Java source line #129	-> byte code offset #161
    //   Java source line #131	-> byte code offset #169
    //   Java source line #132	-> byte code offset #178
    //   Java source line #133	-> byte code offset #186
    //   Java source line #134	-> byte code offset #194
    //   Java source line #135	-> byte code offset #205
    //   Java source line #138	-> byte code offset #213
    //   Java source line #139	-> byte code offset #215
    //   Java source line #140	-> byte code offset #225
    //   Java source line #141	-> byte code offset #233
    //   Java source line #142	-> byte code offset #239
    //   Java source line #140	-> byte code offset #242
    //   Java source line #141	-> byte code offset #248
    //   Java source line #144	-> byte code offset #254
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	256	0	this	HybridAppCLIBuilder
    //   0	256	1	resource	Resource
    //   7	248	2	result	BuildResult
    //   15	166	3	pathStr	String
    //   20	75	4	fragments	String[]
    //   26	145	5	segment	String
    //   29	220	6	contents	InputStream
    //   41	5	7	resourceLayer	ResourceLayer
    //   213	7	7	e	IOException
    //   63	13	8	newPath	String
    //   98	46	8	segment2nd	String
    //   184	13	8	newPath	String
    //   148	5	9	newPath	String
    //   192	7	9	modifiedBytes	byte[]
    //   225	15	10	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   31	210	213	java/io/IOException
    //   31	225	225	finally
  }
  
  protected boolean isBinaryFolder(String name)
  {
    String[] arrayOfString;
    int j = (arrayOfString = OSP_BINARY_FOLDER).length;
    for (int i = 0; i < j; i++)
    {
      String binFolder = arrayOfString[i];
      if (binFolder.equals(name)) {
        return true;
      }
    }
    return false;
  }
  
  protected boolean isBinaryFile(Resource res, String name)
  {
    if ("Hybrid CLI Referenced Resource Layer".equals(res.getLayer().getName())) {
      return name.endsWith(".exe");
    }
    return false;
  }
  
  protected boolean isMovableFolder(String name)
  {
    String[] arrayOfString;
    int j = (arrayOfString = OSP_MOVABLE_FOLDER).length;
    for (int i = 0; i < j; i++)
    {
      String folder = arrayOfString[i];
      if (folder.equals(name)) {
        return true;
      }
    }
    return false;
  }
  
  protected boolean isManifestFile(String name)
  {
    return OSP_MANIFEST.equals(name);
  }
  
  protected Resource addResource(Resource resource, String newPath, InputStream in, BuildResult result)
    throws IOException
  {
    String origPath = resource.getPath();
    
    logger.debug("Moving from {} to {}", origPath, newPath);
    
    FileHandler fh = resource.getFileHandler();
    Object type = fh.get(origPath, FileHandler.Attribute.TYPE);
    String dir = FileHandler.Type.DIRECTORY.equals(type) ? newPath : FilenameUtil.removeTailingPath(newPath, 1);
    if (!fh.is(dir, FileHandler.Attribute.EXISTS)) {
      fh.makeDirectory(dir, true);
    }
    Resource out = getResourceLayer().addResource(newPath, in);
    result.addDependency(resource, out);
    
    return out;
  }
  
  /* Error */
  protected Resource addResource(Resource resource, String newPath, byte[] contents, BuildResult result)
    throws IOException
  {
    // Byte code:
    //   0: aconst_null
    //   1: astore 5
    //   3: new 313	java/io/ByteArrayInputStream
    //   6: dup
    //   7: aload_3
    //   8: invokespecial 315	java/io/ByteArrayInputStream:<init>	([B)V
    //   11: astore 5
    //   13: aload_0
    //   14: aload_1
    //   15: aload_2
    //   16: aload 5
    //   18: aload 4
    //   20: invokevirtual 187	org/tizen/web/builder/HybridAppCLIBuilder:addResource	(Lorg/tizen/common/builder/Resource;Ljava/lang/String;Ljava/io/InputStream;Lorg/tizen/common/builder/BuildResult;)Lorg/tizen/common/builder/Resource;
    //   23: astore 7
    //   25: iconst_1
    //   26: anewarray 95	java/lang/Object
    //   29: dup
    //   30: iconst_0
    //   31: aload 5
    //   33: aastore
    //   34: invokestatic 215	org/tizen/common/util/IOUtil:tryClose	([Ljava/lang/Object;)V
    //   37: aload 7
    //   39: areturn
    //   40: astore 6
    //   42: iconst_1
    //   43: anewarray 95	java/lang/Object
    //   46: dup
    //   47: iconst_0
    //   48: aload 5
    //   50: aastore
    //   51: invokestatic 215	org/tizen/common/util/IOUtil:tryClose	([Ljava/lang/Object;)V
    //   54: aload 6
    //   56: athrow
    // Line number table:
    //   Java source line #228	-> byte code offset #0
    //   Java source line #230	-> byte code offset #3
    //   Java source line #231	-> byte code offset #13
    //   Java source line #232	-> byte code offset #25
    //   Java source line #233	-> byte code offset #31
    //   Java source line #231	-> byte code offset #37
    //   Java source line #232	-> byte code offset #40
    //   Java source line #233	-> byte code offset #48
    //   Java source line #234	-> byte code offset #54
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	57	0	this	HybridAppCLIBuilder
    //   0	57	1	resource	Resource
    //   0	57	2	newPath	String
    //   0	57	3	contents	byte[]
    //   0	57	4	result	BuildResult
    //   1	48	5	bis	java.io.ByteArrayInputStream
    //   40	15	6	localObject	Object
    //   23	15	7	localResource	Resource
    // Exception table:
    //   from	to	target	type
    //   3	25	40	finally
  }
  
  /* Error */
  public String getPackageIDFromConfiguration()
    throws IOException, ParserConfigurationException, SAXException
  {
    // Byte code:
    //   0: aload_0
    //   1: invokevirtual 295	org/tizen/web/builder/HybridAppCLIBuilder:getResourceLayer	()Lorg/tizen/common/builder/ResourceLayer;
    //   4: ldc_w 326
    //   7: invokevirtual 328	org/tizen/common/builder/ResourceLayer:getResource	(Ljava/lang/String;)Lorg/tizen/common/builder/Resource;
    //   10: astore_1
    //   11: aload_1
    //   12: ifnonnull +13 -> 25
    //   15: new 221	java/io/IOException
    //   18: dup
    //   19: ldc 19
    //   21: invokespecial 332	java/io/IOException:<init>	(Ljava/lang/String;)V
    //   24: athrow
    //   25: new 335	org/tizen/web/builder/ConfigurationParserHandler
    //   28: dup
    //   29: invokespecial 337	org/tizen/web/builder/ConfigurationParserHandler:<init>	()V
    //   32: astore_2
    //   33: aload_1
    //   34: invokevirtual 162	org/tizen/common/builder/Resource:getContents	()Ljava/io/InputStream;
    //   37: astore_3
    //   38: invokestatic 338	javax/xml/parsers/SAXParserFactory:newInstance	()Ljavax/xml/parsers/SAXParserFactory;
    //   41: invokevirtual 344	javax/xml/parsers/SAXParserFactory:newSAXParser	()Ljavax/xml/parsers/SAXParser;
    //   44: astore 4
    //   46: aload 4
    //   48: aload_3
    //   49: aload_2
    //   50: invokevirtual 348	javax/xml/parsers/SAXParser:parse	(Ljava/io/InputStream;Lorg/xml/sax/helpers/DefaultHandler;)V
    //   53: goto +19 -> 72
    //   56: astore 5
    //   58: iconst_1
    //   59: anewarray 95	java/lang/Object
    //   62: dup
    //   63: iconst_0
    //   64: aload_3
    //   65: aastore
    //   66: invokestatic 215	org/tizen/common/util/IOUtil:tryClose	([Ljava/lang/Object;)V
    //   69: aload 5
    //   71: athrow
    //   72: iconst_1
    //   73: anewarray 95	java/lang/Object
    //   76: dup
    //   77: iconst_0
    //   78: aload_3
    //   79: aastore
    //   80: invokestatic 215	org/tizen/common/util/IOUtil:tryClose	([Ljava/lang/Object;)V
    //   83: aload_2
    //   84: invokevirtual 354	org/tizen/web/builder/ConfigurationParserHandler:getPkgID	()Ljava/lang/String;
    //   87: areturn
    // Line number table:
    //   Java source line #246	-> byte code offset #0
    //   Java source line #247	-> byte code offset #11
    //   Java source line #248	-> byte code offset #15
    //   Java source line #251	-> byte code offset #25
    //   Java source line #253	-> byte code offset #33
    //   Java source line #255	-> byte code offset #38
    //   Java source line #256	-> byte code offset #46
    //   Java source line #257	-> byte code offset #56
    //   Java source line #258	-> byte code offset #64
    //   Java source line #259	-> byte code offset #69
    //   Java source line #257	-> byte code offset #72
    //   Java source line #258	-> byte code offset #78
    //   Java source line #261	-> byte code offset #83
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	88	0	this	HybridAppCLIBuilder
    //   10	24	1	config	Resource
    //   32	52	2	parserHandler	ConfigurationParserHandler
    //   37	42	3	contents	InputStream
    //   44	3	4	parser	javax.xml.parsers.SAXParser
    //   56	14	5	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   38	56	56	finally
  }
  
  protected byte[] synchronizeAppID(InputStream inputStream)
    throws BuildException
  {
    try
    {
      String inputString = new String(IOUtil.getBytes(inputStream, true));
      
      String applicationPkgID = getPackageIDFromConfiguration();
      if (applicationPkgID != null)
      {
        logger.debug("Change the package id : {}", applicationPkgID);
        String replacedString = inputString.replaceFirst(
          "<Id>.*</Id>", 
          "<Id>" + applicationPkgID + "</Id>");
        
        return replacedString.getBytes();
      }
      throw new IOException("Couldn't find a package ID in the widget configuration file(config.xml).");
    }
    catch (IOException e)
    {
      throw new BuildException(e);
    }
    catch (ParserConfigurationException e)
    {
      throw new BuildException(e);
    }
    catch (SAXException e)
    {
      throw new BuildException(e);
    }
  }
  
  public boolean isBinaryFound()
  {
    return binaryFound;
  }
  
  public boolean isManifestFound()
  {
    return manifestFound;
  }
}

/* Location:
 * Qualified Name:     org.tizen.web.builder.HybridAppCLIBuilder
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.web.builder;

import java.io.IOException;
import org.slf4j.Logger;
import org.tizen.common.FactoryWithArgument;
import org.tizen.common.builder.Builder;
import org.tizen.common.builder.Resource;
import org.tizen.common.builder.ResourceLayer;
import org.tizen.common.builder.core.AbstractBuilder;
import org.tizen.common.file.FileHandler;
import org.tizen.common.file.FileHandler.Attribute;
import org.tizen.common.file.Filter;
import org.tizen.common.file.SimpleFileFilter;
import org.tizen.common.file.filter.WildCardFilterFactory;
import org.tizen.web.compressor.minifier.core.JavaScriptMinifier;

public class JSMinifyBuilder
  extends AbstractBuilder
  implements Builder
{
  public static final String RESOURCE_LAYER_NAME = "javascript minify layer";
  private SimpleFileFilter filter = new SimpleFileFilter(true);
  private FactoryWithArgument<Filter, String> filterFactory = new WildCardFilterFactory();
  JavaScriptMinifier jsMin = new JavaScriptMinifier();
  
  public JSMinifyBuilder(ResourceLayer layer)
  {
    super(layer);
  }
  
  public boolean canBuild(Resource resource)
  {
    if (resource == null) {
      return false;
    }
    FileHandler fh = resource.getFileHandler();
    String path = resource.getPath();
    try
    {
      if (!fh.is(path, FileHandler.Attribute.EXISTS)) {
        return false;
      }
    }
    catch (IOException localIOException)
    {
      return false;
    }
    if (!filter.accept(null, path))
    {
      logger.debug("Ignore {}", path);
      return false;
    }
    return jsMin.canHandle(path);
  }
  
  /* Error */
  public org.tizen.common.builder.BuildResult build(Resource resource)
    throws org.tizen.common.builder.exception.BuildException
  {
    // Byte code:
    //   0: aconst_null
    //   1: astore_2
    //   2: aconst_null
    //   3: astore_3
    //   4: aload_1
    //   5: invokevirtual 109	org/tizen/common/builder/Resource:getContents	()Ljava/io/InputStream;
    //   8: astore_2
    //   9: new 113	java/io/ByteArrayOutputStream
    //   12: dup
    //   13: invokespecial 115	java/io/ByteArrayOutputStream:<init>	()V
    //   16: astore_3
    //   17: aload_0
    //   18: getfield 78	org/tizen/web/builder/JSMinifyBuilder:logger	Lorg/slf4j/Logger;
    //   21: ldc 116
    //   23: aload_1
    //   24: invokevirtual 58	org/tizen/common/builder/Resource:getPath	()Ljava/lang/String;
    //   27: invokeinterface 84 3 0
    //   32: aload_0
    //   33: getfield 42	org/tizen/web/builder/JSMinifyBuilder:jsMin	Lorg/tizen/web/compressor/minifier/core/JavaScriptMinifier;
    //   36: aload_2
    //   37: aload_3
    //   38: invokevirtual 118	org/tizen/web/compressor/minifier/core/JavaScriptMinifier:compress	(Ljava/io/InputStream;Ljava/io/OutputStream;)V
    //   41: aload_0
    //   42: getfield 122	org/tizen/web/builder/JSMinifyBuilder:layer	Lorg/tizen/common/builder/ResourceLayer;
    //   45: aload_1
    //   46: invokevirtual 58	org/tizen/common/builder/Resource:getPath	()Ljava/lang/String;
    //   49: aload_3
    //   50: invokevirtual 124	java/io/ByteArrayOutputStream:toByteArray	()[B
    //   53: invokevirtual 128	org/tizen/common/builder/ResourceLayer:addResource	(Ljava/lang/String;[B)Lorg/tizen/common/builder/Resource;
    //   56: astore 4
    //   58: new 134	org/tizen/common/builder/BuildResult
    //   61: dup
    //   62: invokespecial 136	org/tizen/common/builder/BuildResult:<init>	()V
    //   65: astore 5
    //   67: aload 5
    //   69: aload_1
    //   70: aload 4
    //   72: invokevirtual 137	org/tizen/common/builder/BuildResult:addDependency	(Lorg/tizen/common/builder/Resource;Lorg/tizen/common/builder/Resource;)V
    //   75: aload 5
    //   77: astore 7
    //   79: iconst_2
    //   80: anewarray 141	java/lang/Object
    //   83: dup
    //   84: iconst_0
    //   85: aload_2
    //   86: aastore
    //   87: dup
    //   88: iconst_1
    //   89: aload_3
    //   90: aastore
    //   91: invokestatic 143	org/tizen/common/util/IOUtil:tryClose	([Ljava/lang/Object;)V
    //   94: aload 7
    //   96: areturn
    //   97: astore 4
    //   99: new 149	org/tizen/web/builder/exception/MinifyException
    //   102: dup
    //   103: aload_1
    //   104: invokevirtual 58	org/tizen/common/builder/Resource:getPath	()Ljava/lang/String;
    //   107: aload 4
    //   109: invokevirtual 151	org/mozilla/javascript/EvaluatorException:lineNumber	()I
    //   112: aload 4
    //   114: invokevirtual 157	org/mozilla/javascript/EvaluatorException:columnNumber	()I
    //   117: aload 4
    //   119: invokevirtual 160	org/mozilla/javascript/EvaluatorException:lineSource	()Ljava/lang/String;
    //   122: aload 4
    //   124: invokespecial 163	org/tizen/web/builder/exception/MinifyException:<init>	(Ljava/lang/String;IILjava/lang/String;Ljava/lang/Throwable;)V
    //   127: athrow
    //   128: astore 4
    //   130: new 107	org/tizen/common/builder/exception/BuildException
    //   133: dup
    //   134: aload 4
    //   136: invokespecial 166	org/tizen/common/builder/exception/BuildException:<init>	(Ljava/lang/Throwable;)V
    //   139: athrow
    //   140: astore 6
    //   142: iconst_2
    //   143: anewarray 141	java/lang/Object
    //   146: dup
    //   147: iconst_0
    //   148: aload_2
    //   149: aastore
    //   150: dup
    //   151: iconst_1
    //   152: aload_3
    //   153: aastore
    //   154: invokestatic 143	org/tizen/common/util/IOUtil:tryClose	([Ljava/lang/Object;)V
    //   157: aload 6
    //   159: athrow
    // Line number table:
    //   Java source line #87	-> byte code offset #0
    //   Java source line #88	-> byte code offset #2
    //   Java source line #91	-> byte code offset #4
    //   Java source line #92	-> byte code offset #9
    //   Java source line #94	-> byte code offset #17
    //   Java source line #95	-> byte code offset #32
    //   Java source line #97	-> byte code offset #41
    //   Java source line #99	-> byte code offset #58
    //   Java source line #101	-> byte code offset #67
    //   Java source line #103	-> byte code offset #75
    //   Java source line #108	-> byte code offset #79
    //   Java source line #109	-> byte code offset #85
    //   Java source line #103	-> byte code offset #94
    //   Java source line #104	-> byte code offset #97
    //   Java source line #105	-> byte code offset #99
    //   Java source line #106	-> byte code offset #128
    //   Java source line #107	-> byte code offset #130
    //   Java source line #108	-> byte code offset #140
    //   Java source line #109	-> byte code offset #148
    //   Java source line #110	-> byte code offset #157
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	160	0	this	JSMinifyBuilder
    //   0	160	1	resource	Resource
    //   1	148	2	is	java.io.InputStream
    //   3	150	3	os	java.io.ByteArrayOutputStream
    //   56	15	4	out	Resource
    //   97	26	4	e	org.mozilla.javascript.EvaluatorException
    //   128	7	4	e	IOException
    //   65	11	5	ret	org.tizen.common.builder.BuildResult
    //   140	18	6	localObject	Object
    //   77	18	7	localBuildResult1	org.tizen.common.builder.BuildResult
    // Exception table:
    //   from	to	target	type
    //   4	79	97	org/mozilla/javascript/EvaluatorException
    //   4	79	128	java/io/IOException
    //   4	79	140	finally
    //   97	140	140	finally
  }
  
  public void setExcludes(String[] excludes)
  {
    filter.clearExcludes();
    if (excludes != null)
    {
      String[] arrayOfString;
      int j = (arrayOfString = excludes).length;
      for (int i = 0; i < j; i++)
      {
        String exclude = arrayOfString[i];
        filter.addExcludes(new Filter[] { (Filter)filterFactory.create(exclude) });
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.tizen.web.builder.JSMinifyBuilder
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.web.builder;

import org.tizen.common.builder.BuildResult;
import org.tizen.common.builder.Resource;
import org.tizen.common.builder.ResourceLayer;
import org.tizen.common.builder.core.AbstractBuilder;
import org.tizen.common.builder.exception.BuildException;

public class JavaScriptConcatenator
  extends AbstractBuilder
{
  public JavaScriptConcatenator()
  {
    this(null);
  }
  
  public JavaScriptConcatenator(ResourceLayer layer)
  {
    super(layer);
  }
  
  public boolean canBuild(Resource resource)
  {
    return false;
  }
  
  public BuildResult build(Resource resource)
    throws BuildException
  {
    return null;
  }
}

/* Location:
 * Qualified Name:     org.tizen.web.builder.JavaScriptConcatenator
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.web.builder;

import org.tizen.common.builder.BuildResult;
import org.tizen.common.builder.Resource;
import org.tizen.common.builder.ResourceLayer;
import org.tizen.common.builder.core.AbstractBuilder;
import org.tizen.common.builder.exception.BuildException;

public class JavaScriptReferer
  extends AbstractBuilder
{
  public JavaScriptReferer()
  {
    this(null);
  }
  
  public JavaScriptReferer(ResourceLayer layer)
  {
    super(layer);
  }
  
  public boolean canBuild(Resource resource)
  {
    return false;
  }
  
  public BuildResult build(Resource resource)
    throws BuildException
  {
    return null;
  }
}

/* Location:
 * Qualified Name:     org.tizen.web.builder.JavaScriptReferer
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.web.builder;

import org.tizen.common.builder.BuildResult;
import org.tizen.common.builder.Resource;
import org.tizen.common.builder.core.AbstractBuilder;
import org.tizen.common.builder.exception.BuildException;

public class SignatureBuilder
  extends AbstractBuilder
{
  public boolean canBuild(Resource resource)
  {
    return true;
  }
  
  public BuildResult build(Resource resource)
    throws BuildException
  {
    return null;
  }
}

/* Location:
 * Qualified Name:     org.tize
1 2

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd