当前位置: 首页>>代码示例>>Java>>正文


Java Artifact类代码示例

本文整理汇总了Java中com.google.gwt.core.ext.linker.Artifact的典型用法代码示例。如果您正苦于以下问题:Java Artifact类的具体用法?Java Artifact怎么用?Java Artifact使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Artifact类属于com.google.gwt.core.ext.linker包,在下文中一共展示了Artifact类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doEmitCompilation

import com.google.gwt.core.ext.linker.Artifact; //导入依赖的package包/类
@Override
protected Collection<Artifact<?>> doEmitCompilation(TreeLogger logger,
    LinkerContext context, CompilationResult result, ArtifactSet artifacts)
    throws UnableToCompleteException {

  String[] js = result.getJavaScript();
  if (js.length != 1) {
    logger.branch(TreeLogger.ERROR, getMultiFragmentWarningMessage(), null);
    throw new UnableToCompleteException();
  }

  Collection<Artifact<?>> toReturn = new ArrayList<Artifact<?>>();
  toReturn.add(new Script(result.getStrongName(), js[0]));
  toReturn.addAll(emitSelectionInformation(result.getStrongName(), result));
  return toReturn;
}
 
开发者ID:metteo,项目名称:gwt-worker,代码行数:17,代码来源:SingleScriptLinker.java

示例2: createCacheManifest

import com.google.gwt.core.ext.linker.Artifact; //导入依赖的package包/类
private Artifact<?> createCacheManifest(LinkerContext context,
        TreeLogger logger, Set<String> artifacts, String userAgent)
        throws UnableToCompleteException {

    StringBuilder cm = new StringBuilder();
    cm.append("CACHE MANIFEST\n");
    cm.append("# Build time" + new Date());
    cm.append("\n\nCACHE:\n");

    for (String fn : artifacts) {
        cm.append(fn);
        cm.append("\n");
    }
    cm.append("\nNETWORK:\n");
    cm.append("*\n\n");

    String manifest = cm.toString();
    String manifestName = userAgent + ".manifest";

    return emitString(logger, manifest, manifestName);
}
 
开发者ID:vaadin,项目名称:touchkit,代码行数:22,代码来源:CacheManifestLinker.java

示例3: emitLandingPageCacheManifest

import com.google.gwt.core.ext.linker.Artifact; //导入依赖的package包/类
/**
 * Creates the cache-manifest resource specific for the landing page.
 */
private Artifact<?> emitLandingPageCacheManifest(LinkerContext context, TreeLogger logger,
    ArtifactSet artifacts, String[] staticFiles) throws UnableToCompleteException {
  // Create a string of cacheable resources
  StringBuilder publicSourcesSb = new StringBuilder();
  StringBuilder publicStaticSourcesSb = new StringBuilder();

  // Iterate over all emitted artifacts, and collect all cacheable artifacts
  for (@SuppressWarnings("rawtypes")
  Artifact artifact : artifacts) {
    if (artifact instanceof EmittedArtifact) {
      EmittedArtifact ea = (EmittedArtifact) artifact;
      String path = "/" + context.getModuleFunctionName() + "/" + ea.getPartialPath();

      if (accept(path)) {
        publicSourcesSb.append(path + "\n");
      }
    }
  }

  // Iterate over all static files
  if (staticFiles != null) {
    for (String staticFile : staticFiles) {
      if (accept(staticFile)) {
        publicStaticSourcesSb.append(staticFile + "\n");
      }
    }
  }

  // build cache list
  StringBuilder sb = new StringBuilder();
  sb.append("CACHE MANIFEST\n");
  sb.append("# Unique id #" + (new Date()).getTime() + "." + Math.random() + "\n");
  // we have to generate this unique id because the resources can change but
  // the hashed cache.html files can remain the same.
  sb.append("# Note: must change this every time for cache to invalidate\n");
  sb.append("\n");
  sb.append("CACHE:\n");
  sb.append(publicSourcesSb.toString());
  sb.append("# Static cached files\n");
  sb.append(publicStaticSourcesSb.toString());
  sb.append("\n\n");
  sb.append("# All other resources require the user to be online.\n");
  sb.append("NETWORK:\n");
  sb.append("*\n");

  logger.log(TreeLogger.DEBUG, "Make sure you have the following"
      + " attribute added to your landing page's <html> tag: <html manifest=\""
      + context.getModuleFunctionName() + "/" + MANIFEST + "\">");

  // Create the manifest as a new artifact and return it:
  return emitString(logger, sb.toString(), MANIFEST);
}
 
开发者ID:playn,项目名称:playn,代码行数:56,代码来源:AppCacheLinker.java

示例4: commitArtifact

import com.google.gwt.core.ext.linker.Artifact; //导入依赖的package包/类
public void commitArtifact(TreeLogger logger,
                           Artifact<?> artifact)
  throws UnableToCompleteException {
  // nothing to do
}
 
开发者ID:mvp4g,项目名称:mvp4g,代码行数:6,代码来源:GeneratorContextStub.java

示例5: emitLandingPageCacheManifest

import com.google.gwt.core.ext.linker.Artifact; //导入依赖的package包/类
/**
 * Creates the cache-manifest resource specific for the landing page.
 * 
 * @param context
 *            the linker environment
 * @param logger
 *            the tree logger to record to
 * @param artifacts
 *            {@code null} to generate an empty cache manifest
 */
@SuppressWarnings( "rawtypes" )
private Artifact<?> emitLandingPageCacheManifest( LinkerContext context, TreeLogger logger, ArtifactSet artifacts ) throws UnableToCompleteException
{
	StringBuilder publicSourcesSb = new StringBuilder();
	StringBuilder staticResoucesSb = new StringBuilder();

	if( artifacts != null )
	{
		// Iterate over all emitted artifacts, and collect all cacheable
		// artifacts
		for( Artifact artifact : artifacts )
		{
			if( artifact instanceof EmittedArtifact )
			{
				EmittedArtifact ea = (EmittedArtifact) artifact;
				String pathName = ea.getPartialPath();
				if( pathName.endsWith( "symbolMap" ) || pathName.endsWith( ".xml.gz" ) || pathName.endsWith( "rpc.log" ) || pathName.endsWith( "gwt.rpc" ) || pathName.endsWith( "manifest.txt" ) || pathName.startsWith( "rpcPolicyManifest" )
						|| pathName.startsWith( "soycReport" ) || pathName.endsWith( ".cssmap" ) )
				{
					continue;// skip these resources
				}
				else
				{
					publicSourcesSb.append( context.getModuleName() ).append( "/" ).append( pathName.replace( "\\", "/" ) ).append( "\n" );
				}
			}
		}

		String[] cacheExtraFiles = getCacheExtraFiles( logger, context );
		for( int i = 0; i < cacheExtraFiles.length; i++ )
		{
			staticResoucesSb.append( cacheExtraFiles[i] );
			staticResoucesSb.append( "\n" );
		}
	}

	// build cache list
	StringBuilder sb = new StringBuilder();
	sb.append( "CACHE MANIFEST\n" );
	sb.append( "# " + UUID.randomUUID() + "-" + System.currentTimeMillis() + "\n" );
	// we have to generate this unique id because the resources can change
	// but
	// the hashed cache.html files can remain the same.
	sb.append( "# Note: must change this every time for cache to invalidate\n" );
	sb.append( "\n" );
	sb.append( "CACHE:\n" );
	sb.append( "# Static app files\n" );
	sb.append( staticResoucesSb );
	sb.append( "\n# Generated app files\n" );
	sb.append( publicSourcesSb );
	sb.append( "\n\n" );
	sb.append( "# All other resources require the user to be online.\n" );
	sb.append( "NETWORK:\n" );
	sb.append( "*\n" );
	sb.append( "http://*\n" );
	sb.append( "\n\n" );
	sb.append( "# Available values: fast, prefer-online\n" );
	sb.append( "SETTINGS:\n" );
	sb.append( "fast\n" );
	logger.log( TreeLogger.DEBUG, "Be sure your landing page's <html> tag declares a manifest: <html manifest=" + MANIFEST + "\">" );

	// Create the manifest as a new artifact and return it:
	return emitString( logger, sb.toString(), "../" + MANIFEST );
}
 
开发者ID:ltearno,项目名称:hexa.tools,代码行数:75,代码来源:AppCacheLinker.java

示例6: emitLandingPageCacheManifest

import com.google.gwt.core.ext.linker.Artifact; //导入依赖的package包/类
/**
 * Creates the cache-manifest resource specific for the landing page.
 * 
 * @param context the linker environment
 * @param logger the tree logger to record to 
 * @param artifacts {@code null} to generate an empty cache manifest
 */
private Artifact<?> emitLandingPageCacheManifest(LinkerContext context, TreeLogger logger,
    ArtifactSet artifacts)
    throws UnableToCompleteException {
  StringBuilder publicSourcesSb = new StringBuilder();
  StringBuilder staticResoucesSb = new StringBuilder();

  if (artifacts != null) {
    // Iterate over all emitted artifacts, and collect all cacheable artifacts
    for (@SuppressWarnings("rawtypes") Artifact artifact : artifacts) {
      if (artifact instanceof EmittedArtifact) {
        EmittedArtifact ea = (EmittedArtifact) artifact;
        String pathName = ea.getPartialPath();
        if (pathName.endsWith("symbolMap") 
            || pathName.endsWith(".xml.gz") 
            || pathName.endsWith("rpc.log")
            || pathName.endsWith("gwt.rpc")
            || pathName.endsWith("manifest.txt")
            || pathName.startsWith("rpcPolicyManifest")
            || pathName.startsWith("soycReport")) {
          // skip these resources
        } else {
          publicSourcesSb.append(pathName + "\n");
        }
      }
    }

    String[] cacheExtraFiles = getCacheExtraFiles(); 
    for (int i = 0; i < cacheExtraFiles.length; i++) {
      staticResoucesSb.append(cacheExtraFiles[i]);
      staticResoucesSb.append("\n");
    }
  }

  // build cache list
  StringBuilder sb = new StringBuilder();
  sb.append("CACHE MANIFEST\n");
  sb.append("# Unique id #" + (new Date()).getTime() + "." + Math.random() + "\n");
  // we have to generate this unique id because the resources can change but
  // the hashed cache.html files can remain the same.
  sb.append("# Note: must change this every time for cache to invalidate\n");
  sb.append("\n");
  sb.append("CACHE:\n");
  sb.append("# Static app files\n");
  sb.append(staticResoucesSb.toString());
  sb.append("\n# Generated app files\n");
  sb.append(publicSourcesSb.toString());
  sb.append("\n\n");
  sb.append("# All other resources require the user to be online.\n");
  sb.append("NETWORK:\n");
  sb.append("*\n");

  logger.log(TreeLogger.INFO, "Be sure your landing page's <html> tag declares a manifest:"
      + " <html manifest=" + context.getModuleFunctionName() + "/" + MANIFEST + "\">");

  // Create the manifest as a new artifact and return it:
  return emitString(logger, sb.toString(), MANIFEST);
}
 
开发者ID:Peergos,项目名称:Peergos,代码行数:65,代码来源:SimpleAppCacheLinker.java

示例7: addCachedResource

import com.google.gwt.core.ext.linker.Artifact; //导入依赖的package包/类
protected void addCachedResource(Artifact<?> artifact) {
    String string = artifact.toString();
    addCachedResource("" + string);
}
 
开发者ID:vaadin,项目名称:touchkit,代码行数:5,代码来源:CacheManifestLinker.java


注:本文中的com.google.gwt.core.ext.linker.Artifact类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。