List of usage examples for com.google.gwt.core.ext TreeLogger TRACE
Type TRACE
To view the source code for com.google.gwt.core.ext TreeLogger TRACE.
Click Source Link
From source file:com.browsexml.jetty.MyJettyLauncher.java
License:Apache License
@Override public ServletContainer start(TreeLogger logger, int port, File appRootDir) throws Exception { TreeLogger branch = logger.branch(TreeLogger.TRACE, "Starting Jetty on port " + port, null); checkStartParams(branch, port, appRootDir); // Setup our branch logger during startup. Log.setLog(new JettyTreeLogger(branch)); // Force load some JRE singletons that can pin the classloader. jreLeakPrevention(logger);//from ww w .ja v a 2 s . com // Turn off XML validation. System.setProperty("org.mortbay.xml.XmlParser.Validating", "false"); AbstractConnector connector = getConnector(); if (bindAddress != null) { connector.setHost(bindAddress.toString()); } connector.setPort(port); // Don't share ports with an existing process. connector.setReuseAddress(false); // Linux keeps the port blocked after shutdown if we don't disable this. connector.setSoLingerTime(0); Server server = new Server(); server.addConnector(connector); // Create a new web app in the war directory. WebAppContext wac = createWebAppContext(logger, appRootDir); wac.setConfigurationClasses(__dftConfigurationClasses); RequestLogHandler logHandler = new RequestLogHandler(); logHandler.setRequestLog(new JettyRequestLogger(logger, getBaseLogLevel())); logHandler.setHandler(wac); server.setHandler(logHandler); server.start(); server.setStopAtShutdown(true); // Now that we're started, log to the top level logger. Log.setLog(new JettyTreeLogger(logger)); return createServletContainer(logger, appRootDir, server, wac, connector.getLocalPort()); }
From source file:com.eleven.rebind.SkinBundleBuilder.java
License:Apache License
public String writeBundledImage(final TreeLogger logger, final GeneratorContext context) throws UnableToCompleteException { // Create the bundled image from all of the constituent images. BufferedImage bundledImage = drawBundledImage(); // Write the bundled image into a byte array, so that we can compute // its strong name. byte[] imageBytes; try {//from www . jav a 2 s . c o m ByteArrayOutputStream byteOutputStream = new ByteArrayOutputStream(); ImageIO.write(bundledImage, BUNDLE_FILE_TYPE, byteOutputStream); imageBytes = byteOutputStream.toByteArray(); } catch (IOException e) { logger.log(TreeLogger.ERROR, "Unable to generate file name for image bundle file", null); throw new UnableToCompleteException(); } // Compute the file name. The strong name is generated from the bytes of // the bundled image. The '.cache' part indicates that it can be // permanently cached. String bundleFileName = Util.computeStrongName(imageBytes) + ".cache." + BUNDLE_FILE_TYPE; // Try and write the file to disk. If a file with bundleFileName already // exists, then the file will not be written. OutputStream outStream = context.tryCreateResource(logger, bundleFileName); if (outStream != null) { try { // Write the image bytes from the byte array to the pending // stream. outStream.write(imageBytes); // Commit the stream. context.commitResource(logger, outStream); } catch (IOException e) { logger.log(TreeLogger.ERROR, "Failed while writing", e); throw new UnableToCompleteException(); } } else logger.log(TreeLogger.TRACE, "Generated image bundle file already exists; no need to rewrite it.", null); return bundleFileName; }
From source file:com.eleven.rebind.SkinBundleBuilder.java
License:Apache License
private ImageRect addImage(TreeLogger logger, final String imageName) throws UnableToCompleteException { logger = logger.branch(TreeLogger.TRACE, "Adding image '" + imageName + "'", null); // Fetch the image. try {/*from w w w . ja va 2 s . c om*/ /* // Could turn this lookup logic into an externally-supplied policy // for // increased generality. URL imageUrl = getClass().getClassLoader().getResource(imageName); if (imageUrl == null) { */ // 11pc File file = new File(imageName); if (!file.exists()) { // This should never happen, because this check is done right // after // the image name is retrieved from the metadata or the method // name. // If there is a failure in obtaining the resource, it will // happen // before this point. logger.log(TreeLogger.ERROR, "Resource not found on classpath (is the name specified as " + "Class.getResource() would expect?)", null); throw new UnableToCompleteException(); } BufferedImage image; // Load the image try { image = ImageIO.read(file); } catch (IllegalArgumentException iex) { if (imageName.toLowerCase().endsWith("png") && iex.getMessage() != null && iex.getStackTrace()[0] .getClassName().equals("javax.imageio.ImageTypeSpecifier$Indexed")) { logger.log(TreeLogger.ERROR, "Unable to read image. The image may not be in valid PNG format. " + "This problem may also be due to a bug in versions of the " + "JRE prior to 1.6. See " + "http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5098176 " + "for more information. If this bug is the cause of the " + "error, try resaving the image using a different image " + "program, or upgrade to a newer JRE.", null); throw new UnableToCompleteException(); } else throw iex; } if (image == null) { logger.log(TreeLogger.ERROR, "Unrecognized image file format", null); throw new UnableToCompleteException(); } return new ImageRect(imageName, image); } catch (IOException e) { logger.log(TreeLogger.ERROR, "Unable to read image resource", null); throw new UnableToCompleteException(); } }
From source file:com.google.gdt.eclipse.designer.hosted.tdz.HostedModeSupport.java
License:Open Source License
public HostedModeSupport(ClassLoader parentClassLoader, IModuleDescription moduleDescription) throws Exception { m_parentClassLoader = parentClassLoader; m_moduleDescription = moduleDescription; m_javaProject = moduleDescription.getJavaProject(); // Logger// w w w . j a v a 2 s. c o m m_logSupport = new LogSupport(TreeLogger.TRACE, m_javaProject); // Class loaders createClassLoaders(); // Browser shell m_browserShell = (BrowserShell) createBrowserShell(); m_browserShell.setHost(this); }
From source file:com.gwtplatform.dispatch.rest.rebind.utils.Logger.java
License:Apache License
public void trace(String message, Object... params) { String format = String.format(message, params); treeLogger.log(TreeLogger.TRACE, format); }
From source file:com.mvp4g.rebind.Mvp4gGenerator.java
License:Apache License
private boolean checkSet(TreeLogger logger, GeneratorContext ctx, Set<? extends Mvp4gElement> setOfElements) { long lastTimeGenerated = ctx.getCachedGeneratorResult().getTimeGenerated(); for (Mvp4gElement element : setOfElements) { JClassType sourceType = ctx.getTypeOracle().findType(element.getProperty("class")); if (sourceType == null) { logger.log(TreeLogger.TRACE, "Found previously dependent type that's no longer present: " + element.getProperty("class")); return false; }//from ww w . ja va 2 s.co m assert sourceType instanceof JRealClassType; JRealClassType realClass = (JRealClassType) sourceType; if (realClass == null || realClass.getLastModifiedTime() > lastTimeGenerated) { return false; } } return true; }
From source file:com.mvp4g.rebind.Mvp4gGenerator.java
License:Apache License
private boolean checkEventBus(TreeLogger logger, GeneratorContext ctx) { long lastTimeGenerated = ctx.getCachedGeneratorResult().getTimeGenerated(); JClassType sourceType = ctx.getTypeOracle().findType(EventBusElement.class.getName()); if (sourceType == null) { logger.log(TreeLogger.TRACE, "Found previously dependent type that's no longer present: " + EventBusElement.class.getName()); return false; }/* www .j a v a 2 s . c o m*/ assert sourceType instanceof JRealClassType; JRealClassType realClass = (JRealClassType) sourceType; if (realClass == null || realClass.getLastModifiedTime() > lastTimeGenerated) { return false; } return true; }
From source file:com.mvp4g.rebind.Mvp4gGenerator.java
License:Apache License
private boolean checkModule(TreeLogger logger, GeneratorContext ctx, JClassType module) { long lastTimeGenerated = ctx.getCachedGeneratorResult().getTimeGenerated(); if (module == null) { logger.log(TreeLogger.TRACE, "Found previously dependent type that's no longer present: " + Mvp4gModule.class.getName()); return false; }/* ww w . jav a 2s . co m*/ assert module instanceof JRealClassType; JRealClassType realClass = (JRealClassType) module; if (realClass == null || realClass.getLastModifiedTime() > lastTimeGenerated) { return false; } return true; }
From source file:com.rhizospherejs.gwt.rebind.BridgeCapabilities.java
License:Open Source License
/** * Analyzes {@link #JSO_BUILDER_CLASS} and builds a mapping between Java types * and associated methods that can port values of those types onto a * Rhizosphere model object.//from w ww .ja va 2 s. c o m * * @return this object. * @throws UnableToCompleteException */ public BridgeCapabilities configure() throws UnableToCompleteException { logger.log(TreeLogger.TRACE, "Parsing bridge class " + JSO_BUILDER_CLASS + " to extract mapping methods."); JClassType builderType; try { builderType = oracle.getType(JSO_BUILDER_CLASS); } catch (NotFoundException e) { logger.log(TreeLogger.ERROR, "Unable to build the bridge methods map. Is the builder class " + JSO_BUILDER_CLASS + " missing?"); throw new UnableToCompleteException(); } for (JMethod method : builderType.getInheritableMethods()) { if (isValidBridgeMethod(method)) { BridgeMethod bridgeMethod = new BridgeMethod(method); String targetType = bridgeMethod.getTargetType().getQualifiedSourceName(); bridgeMethods.put(targetType, bridgeMethod); if (targetType.equals("java.lang.Object")) { objectFallbackMethod = bridgeMethod; } if (targetType.equals("java.lang.Object[]")) { objectArrayFallbackMethod = bridgeMethod; } } } if (objectFallbackMethod == null) { logger.log(TreeLogger.ERROR, "Unable to find fallback method for Object types"); throw new UnableToCompleteException(); } if (objectArrayFallbackMethod == null) { logger.log(TreeLogger.ERROR, "Unable to find fallback method for Object[] types"); throw new UnableToCompleteException(); } return this; }
From source file:com.rhizospherejs.gwt.rebind.ModelInspector.java
License:Open Source License
/** * Analyzes a POJO implementing//from w w w. j av a2s. c om * {@link com.rhizospherejs.gwt.client.RhizosphereModel} and identifies all * the attributes that need to be exposed in Rhizosphere, along with their * associated metadata. * * @return this object. * @throws UnableToCompleteException */ public ModelInspector configure() throws UnableToCompleteException { logger.log(TreeLogger.TRACE, "Parsing model class " + modelType.getQualifiedSourceName() + " to identify exportable attributes."); JMethod[] methods = modelType.getInheritableMethods(); for (JMethod method : methods) { if (isValidMethodSignature(method)) { verifyValidReturnType(method); logger.log(TreeLogger.DEBUG, "Found valid attribute for Rhizosphere model generation: " + method.getName()); modelMethods.add(new MappableMethod(method)); } } useCustomAttributes = modelType.isAssignableTo(customAttributesInterfaceType); if (modelMethods.isEmpty() && !useCustomAttributes) { logger.log(TreeLogger.ERROR, "Cannot extract a Rhizosphere model from " + modelType.getQualifiedSourceName() + ". No suitable annotated methods found, and model is not using explicit mapping."); throw new UnableToCompleteException(); } return this; }