Package flex2.compiler.common

Examples of flex2.compiler.common.PathResolver


  {
    List frList = frc.getFrameList();

    for (int i = 0, length = frList == null ? 0 : frList.size(); i < length; i++)
    {
      FrameInfo info = (FrameInfo) frList.get(i);
      setFrameLabel(info.label, toStrings(info.frameClasses));
    }
  }
View Full Code Here


        if ( args == null )
        {
            throw new ConfigurationException.CannotOpen( null, cfgval.getVar(), cfgval.getSource(), cfgval.getLine() );
        }

        PathResolver resolver = new PathResolver();

        if ( resolver == null || configResolver == null )
        {
            throw new ConfigurationException.CannotOpen( null, cfgval.getVar(), cfgval.getSource(), cfgval.getLine() );
        }
View Full Code Here

                e.printStackTrace();
            }
        }
        else
        {
            PathResolver resolver = ThreadLocalToolkit.getPathResolver();
            result = resolver.resolve(path);

            if (result == null && reportError)
            {
                throw new ConfigurationException.IOError(path);
            }
View Full Code Here

        usePathResolver(null);
    }

    public static void usePathResolver(SinglePathResolver resolver)
    {
        PathResolver pathResolver = new PathResolver();
        if (resolver != null)
        {
            pathResolver.addSinglePathResolver(resolver);
        }
        pathResolver.addSinglePathResolver( LocalFilePathResolver.getSingleton() );
        pathResolver.addSinglePathResolver( URLPathResolver.getSingleton() );
        ThreadLocalToolkit.setPathResolver(pathResolver);
    }
View Full Code Here

        {
            result = new LocalFile(FileUtil.getCanonicalFile(file));
        }
        else
        {
            PathResolver resolver = ThreadLocalToolkit.getPathResolver();
            result = resolver.resolve(path);

            if (result == null && reportError)
            {
                throw new ConfigurationException.IOError(path);
            }
View Full Code Here

        usePathResolver(null);
    }

    public static void usePathResolver(SinglePathResolver resolver)
    {
        PathResolver pathResolver = new PathResolver();
        if (resolver != null)
        {
            pathResolver.addSinglePathResolver(resolver);
        }
        pathResolver.addSinglePathResolver( LocalFilePathResolver.getSingleton() );
        pathResolver.addSinglePathResolver( URLPathResolver.getSingleton() );
        ThreadLocalToolkit.setPathResolver(pathResolver);
    }
View Full Code Here

        {
            result = new LocalFile(FileUtil.getCanonicalFile(file));
        }
        else
        {
            PathResolver resolver = ThreadLocalToolkit.getPathResolver();
            result = resolver.resolve(path);

            if (result == null && reportError)
            {
                throw new ConfigurationException.IOError(path);
            }
View Full Code Here

  private void readCompilationUnit(Object[] pool, Map<String, String> mappings, Map<String, Object> rbMappings, InputStream in,
                                     FileSpec fileSpec, SourceList sourceList, SourcePath sourcePath,
                                     ResourceContainer resources, ResourceBundlePath bundlePath, Map<String, Object> owners)
      throws IOException
  {
    PathResolver resolver = ThreadLocalToolkit.getPathResolver();

    String name = (String) pool[readU32(in)];
    String relativePath = (String) pool[readU32(in)];
    String shortName = (String) pool[readU32(in)];
    int owner = readU8(in);

    VirtualFile pathRoot = null;
    // 1 == SourceList
    // 2 == SourcePath
    // 4 == ResourceBundlePath
    if ((owner == 1 ) || (owner == 2) || (owner == 4))
    {
      // C: Unfortunately, PathResolver itself is not a complete solution. For each type
      //    of VirtualFile, there must be a mechanism to recognize the name format and
      //    construct an appropriate VirtualFile instance.
      pathRoot = resolver.resolve((String) pool[readU32(in)]);
    }

    boolean isInternal = (readU8(in) == 1);
    boolean isRoot = (readU8(in) == 1);
    boolean isDebuggable = (readU8(in) == 1);
    boolean hasUnit = (readU8(in) == 1);
    long fileTime = readLong(in);
       
        final boolean hasSignatureChecksum = (readU8(in) == 1);
        Long signatureChecksum = null;
        if (hasSignatureChecksum)
        {
            assert hasUnit;
            signatureChecksum = new Long(readLong(in));
            // SignatureExtension.debug("READ      CRC32: " + signatureChecksum + "\t--> " + name);
        }

    int size = readU32(in);
        Set<VirtualFile> includes = new HashSet<VirtualFile>(size);
    Map<VirtualFile, Long> includeTimes = new HashMap<VirtualFile, Long>(size);

    for (int i = 0; i < size; i++)
    {
      String fileName = (String) pool[readU32(in)];
      VirtualFile f = resolver.resolve(fileName);
      long ts = readLong(in);

      if (f == null)
      {
        // C: create an instance of DeletedFile...
        f = new DeletedFile(fileName);
      }

      includes.add(f);
      includeTimes.put(f, new Long(ts));
    }

    size = readU32(in);
    LocalLogger logger = size == 0 ? null : new LocalLogger(null);

    for (int i = 0; i < size; i++)
    {
      String path = (String) pool[readU32(in)];
      if (path.length() == 0)
      {
        path = null;
      }
      String warning = (String) pool[readU32(in)];
      if (warning.length() == 0)
      {
        warning = null;
      }
      String source = (String) pool[readU32(in)];
      if (source.length() == 0)
      {
        source = null;
      }
      int line = readU32(in);
      int col = readU32(in);
      int errorCode = readU32(in);

      logger.recordWarning(path,
                           line == -1 ? null : IntegerPool.getNumber(line),
                           col == -1 ? null : IntegerPool.getNumber(col),
                           warning,
                           source,
                           errorCode == -1 ? null : IntegerPool.getNumber(errorCode));
    }


    byte[] abc = (hasUnit) ? (byte[]) pool[readU32(in)] : null;
    Source s = null;

    if (owner == 0) // FileSpec
    {
      Collection<Source> c = fileSpec.sources();
      for (Iterator<Source> i = c.iterator(); i.hasNext();)
      {
        s = i.next();
        if (s.getName().equals(name))
        {
          Source.populateSource(s, fileTime, pathRoot, relativePath, shortName, fileSpec, isInternal, isRoot, isDebuggable,
                                includes, includeTimes, logger);
          break;
        }
      }
    }
    else if (owner == 1) // SourceList
    {
      Collection<Source> c = sourceList.sources().values();
      for (Iterator<Source> i = c.iterator(); i.hasNext();)
      {
        s = i.next();
        if (s.getName().equals(name))
        {
          Source.populateSource(s, fileTime, pathRoot, relativePath, shortName, sourceList, isInternal, isRoot, isDebuggable,
                                includes, includeTimes, logger);
          break;
        }
      }
    }
    else if (owner == 2) // SourcePath
    {
      Map<String, Source> c = sourcePath.sources();
      String className = mappings.get(name);

      if ((className != null) && !c.containsKey(className))
      {
        VirtualFile f = resolver.resolve(name);

        if (f == null)
        {
          f = new DeletedFile(name);
        }

        s = Source.newSource(f, fileTime, pathRoot, relativePath, shortName, sourcePath, isInternal, isRoot, isDebuggable,
                             includes, includeTimes, logger);
        c.put(className, s);
      }
      else
      {
        assert false : name;
      }
    }
    else if (owner == 3) // ResourceContainer
    {
      if (resources == null)
      {
        LocalizationManager l10n = ThreadLocalToolkit.getLocalizationManager();
        throw new IOException(l10n.getLocalizedTextString(new NoResourceContainer()));
      }

      s = Source.newSource(abc, name, fileTime, pathRoot, relativePath, shortName, resources, isInternal, isRoot, isDebuggable,
                           includes, includeTimes, logger);
      s = resources.addResource(s);
    }
    else if (owner == 4) // ResourceBundlePath
    {
      Map<String, Source> c = bundlePath.sources();
      Object[] value = (Object[]) rbMappings.get(name);
      String bundleName = (String) value[0];
      String[] rNames = (String[]) value[1];
      String[] rRoots = (String[]) value[2];

      if (bundleName != null)
      {
        VirtualFile[] rFiles = new VirtualFile[rNames.length];

        for (int i = 0; i < rFiles.length; i++)
        {
          if (rNames[i] != null)
          {
            rFiles[i] = resolver.resolve(rNames[i]);
            if (rFiles[i] == null)
            {
              rFiles[i] = new DeletedFile(rNames[i]);
            }
          }
        }

        VirtualFile[] rRootFiles = new VirtualFile[rRoots.length];

        for (int i = 0; i < rRootFiles.length; i++)
        {
          if (rRoots[i] != null)
          {
            rRootFiles[i] = resolver.resolve(rRoots[i]);
            if (rRootFiles[i] == null)
            {
              rRootFiles[i] = new DeletedFile(rRoots[i]);
            }
          }
        }

        VirtualFile f = new ResourceFile(name, bundlePath.getLocales(), rFiles, rRootFiles);
        s = Source.newSource(f, fileTime, pathRoot, relativePath, shortName, bundlePath, isInternal, isRoot, isDebuggable,
                             includes, includeTimes, logger);
        c.put(bundleName, s);
      }
      else
      {
        assert false : name;
      }
    }
        else
        {
            assert false : "owner = " + owner;
        }

    if (logger != null)
    {
      logger.setSource(s);
    }

    if (hasUnit)
    {
      CompilationUnit u = s.newCompilationUnit(null, new CompilerContext());
           
            u.setSignatureChecksum(signatureChecksum);

      u.bytes.addAll(abc);
      u.setWorkflow(readU32(in));
      u.setState(readU32(in));

      size = readU32(in);
      for (int i = 0; i < size; i++)
      {
        u.topLevelDefinitions.add((QName) pool[readU32(in)]);
      }

      size = readU32(in);
      for (int i = 0; i < size; i++)
      {
        MultiName mName = (MultiName) pool[readU32(in)];
        QName qName = (QName) pool[readU32(in)];
        u.inheritanceHistory.put(mName, qName);
        u.inheritance.add(qName);
      }

      size = readU32(in);
      for (int i = 0; i < size; i++)
      {
        MultiName mName = (MultiName) pool[readU32(in)];
        QName qName = (QName) pool[readU32(in)];
        u.typeHistory.put(mName, qName);
        u.types.add(qName);
      }

      size = readU32(in);
      for (int i = 0; i < size; i++)
      {
        MultiName mName = (MultiName) pool[readU32(in)];
        QName qName = (QName) pool[readU32(in)];
        u.namespaceHistory.put(mName, qName);
        u.namespaces.add(qName);
      }

      size = readU32(in);
      for (int i = 0; i < size; i++)
      {
        MultiName mName = (MultiName) pool[readU32(in)];
        QName qName = (QName) pool[readU32(in)];
        u.expressionHistory.put(mName, qName);
        u.expressions.add(qName);
      }

      boolean hasAuxGenerateInfo = readU8(in) == 1;

      if (hasAuxGenerateInfo)
      {
        u.auxGenerateInfo = new HashMap<String, Object>();

        String baseLoaderClass = (String) pool[readU32(in)];
        u.auxGenerateInfo.put("baseLoaderClass", baseLoaderClass.length() > 0 ? baseLoaderClass : null);

        String generateLoaderClass = (String) pool[readU32(in)];
        u.auxGenerateInfo.put("generateLoaderClass", generateLoaderClass.length() > 0 ? generateLoaderClass : null);

        String className = (String) pool[readU32(in)];
        u.auxGenerateInfo.put("windowClass", className.length() > 0 ? className : null);

        String preLoader = (String) pool[readU32(in)];
        u.auxGenerateInfo.put("preloaderClass", preLoader.length() > 0 ? preLoader : null);

        u.auxGenerateInfo.put("usePreloader", new Boolean(readU8(in) == 1));

        Map<String, Object> rootAttributeMap = new HashMap<String, Object>();
        u.auxGenerateInfo.put("rootAttributes", rootAttributeMap);
        readMap(in, pool, rootAttributeMap);

        Map<String, Object> rootAttributeEmbedVars = new HashMap<String, Object>();
        u.auxGenerateInfo.put("rootAttributeEmbedVars", rootAttributeEmbedVars);
        readMap(in, pool, rootAttributeEmbedVars);

        Map<String, Object> rootAttributeEmbedNames = new HashMap<String, Object>();
        u.auxGenerateInfo.put("rootAttributeEmbedNames", rootAttributeEmbedNames);
        readMap(in, pool, rootAttributeEmbedNames);
      }

            if (readU8(in) == 1)
            {
                u.icon = (String) pool[readU32(in)];
                u.iconFile = resolver.resolve((String) pool[readU32(in)]);
            }

      readAssets(pool, u, in);
    }
   
View Full Code Here

    int size = readU32(in);
    if (size > 0)
    {
      final Map<String, AssetInfo> assets = new HashMap<String, AssetInfo>();

      PathResolver resolver = ThreadLocalToolkit.getPathResolver();

      for (int i = 0; i < size; i++)
      {
        String className = (String) pool[readU32(in)];
        String pathName = (String) pool[readU32(in)];

        VirtualFile f = null;
        if (pathName.length() == 0)
        {
          f = null;
        }
        else
        {
          f = resolver.resolve(pathName);
          if (f == null)
          {
            f = new DeletedFile(pathName);
          }
        }
View Full Code Here

                String packageName, String className, TypeTable typeTable)
        {
            FXGNode rootNode = (FXGNode)unit.getContext().getAttribute(FXG_DOM_ROOT);

            FlexFXG2SWFTranscoder transcoder = new FlexFXG2SWFTranscoder(typeTable);
            PathResolver pathResolver = unit.getSource().getPathResolver();
            FlexResourceResolver resolver = new FlexResourceResolver(pathResolver);
            transcoder.setResourceResolver(resolver);

            FXGSymbolClass asset = transcoder.transcode(rootNode, packageName, className);
            return asset;
View Full Code Here

TOP

Related Classes of flex2.compiler.common.PathResolver

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.