org.springframework.roo.support.util
Class TemplateUtils

java.lang.Object
  extended by org.springframework.roo.support.util.TemplateUtils

public abstract class TemplateUtils
extends Object

Utilities for dealing with "templates", which are commonly used by ROO add-ons.

Since:
1.0
Author:
Ben Alex

Constructor Summary
TemplateUtils()
           
 
Method Summary
static Set<URL> findMatchingClasspathResources(org.osgi.framework.BundleContext context, String antPathExpression)
           
static Set<URL> findUrls(org.osgi.framework.BundleContext context, String resourceName)
          Locates URLs that represent a search of all bundles for a given resource.
static InputStream getTemplate(Class<?> clazz, String templateFilename)
          Acquires an InputStream to the requested classloader-derived template.
static String getTemplatePath(Class<?> clazz, String templateFilename)
          Determines the path to the requested template.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TemplateUtils

public TemplateUtils()
Method Detail

getTemplatePath

public static final String getTemplatePath(Class<?> clazz,
                                           String templateFilename)
Determines the path to the requested template.

Parameters:
clazz - which owns the template (required)
templateFilename - the filename of the template (required)
Returns:
the full classloader-specific path to the template (never null)

getTemplate

public static final InputStream getTemplate(Class<?> clazz,
                                            String templateFilename)
Acquires an InputStream to the requested classloader-derived template.

Parameters:
clazz - which owns the template (required)
templateFilename - the filename of the template (required)
Returns:
the input stream (never null; an exception is thrown if cannot be found)

findUrls

public static final Set<URL> findUrls(org.osgi.framework.BundleContext context,
                                      String resourceName)
Locates URLs that represent a search of all bundles for a given resource.

Parameters:
context - that can be used to obtain bundles to search (required)
resourceName - the resource to locate (eg "/foo.txt" will find foo.txt in the root of each bundle)
Returns:
null if there was a failure or a set containing zero or more entries (zero entries means the search was successful but the resource was simply not found)

findMatchingClasspathResources

public static final Set<URL> findMatchingClasspathResources(org.osgi.framework.BundleContext context,
                                                            String antPathExpression)


Copyright © 2009-2010 VMware, Inc. All Rights Reserved.