Codota Logo
MorphlineContext.getTopLevelClasses
Code IndexAdd Codota to your IDE (free)

How to use
getTopLevelClasses
method
in
org.kitesdk.morphline.api.MorphlineContext

Best Java code snippets using org.kitesdk.morphline.api.MorphlineContext.getTopLevelClasses (Showing top 5 results out of 315)

  • Common ways to obtain MorphlineContext
private void myMethod () {
MorphlineContext m =
  • Codota Iconnew MorphlineContext.Builder().build()
  • Smart code suggestions by Codota
}
origin: kite-sdk/kite

public void importCommandBuilders(Collection<String> importSpecs) {
 if (commandBuilders == Collections.EMPTY_MAP) { // intentionally effective no more than once
  commandBuilders = Maps.newHashMap();
  if (LOG.isDebugEnabled()) {
   LOG.debug("Importing commands from Java classpath: {}", System.getProperty("java.class.path"));
  } else {
   LOG.info("Importing commands");
  }
  Collection<Class<CommandBuilder>> builderClasses = getTopLevelClasses(importSpecs, CommandBuilder.class);
  for (Class<CommandBuilder> builderClass : builderClasses) {
   try {
    CommandBuilder builder = builderClass.newInstance();
    for (String builderName : builder.getNames()) {
     LOG.debug("Importing command: {} from class: {}", builderName, builderClass.getName());
     if (builderName.contains(".")) {
      LOG.warn("Command name should not contain a period character: " + builderName);
     }
     commandBuilders.put(builderName, builderClass);
    }
   } catch (Exception e) {
    throw new MorphlineRuntimeException(e);
   }
  }
  LOG.info("Done importing commands");
 }
}
origin: org.kitesdk/kite-morphlines-core

public void importCommandBuilders(Collection<String> importSpecs) {
 if (commandBuilders == Collections.EMPTY_MAP) { // intentionally effective no more than once
  commandBuilders = Maps.newHashMap();
  if (LOG.isDebugEnabled()) {
   LOG.debug("Importing commands from Java classpath: {}", System.getProperty("java.class.path"));
  } else {
   LOG.info("Importing commands");
  }
  Collection<Class<CommandBuilder>> builderClasses = getTopLevelClasses(importSpecs, CommandBuilder.class);
  for (Class<CommandBuilder> builderClass : builderClasses) {
   try {
    CommandBuilder builder = builderClass.newInstance();
    for (String builderName : builder.getNames()) {
     LOG.debug("Importing command: {} from class: {}", builderName, builderClass.getName());
     if (builderName.contains(".")) {
      LOG.warn("Command name should not contain a period character: " + builderName);
     }
     commandBuilders.put(builderName, builderClass);
    }
   } catch (Exception e) {
    throw new MorphlineRuntimeException(e);
   }
  }
  LOG.info("Done importing commands");
 }
}
origin: kite-sdk/kite

@Test
@Ignore
public void testHugeImportSpecs() {
 long start = System.currentTimeMillis();
 List<String> importSpecs = Arrays.asList("com.**", "org.**", "net.*", getClass().getName());
 for (Class clazz : new MorphlineContext().getTopLevelClasses(importSpecs, CommandBuilder.class)) {
  System.out.println("found " + clazz);
 }
 float secs = (System.currentTimeMillis() - start) / 1000.0f;
 System.out.println("secs=" + secs);
}

origin: kite-sdk/kite

@Test
public void testImportSpecs() {
 List<String> importSpecs = Arrays.asList("org.kitesdk.**", "org.apache.solr.**", "net.*", getClass().getName());
 for (Class clazz : new MorphlineContext().getTopLevelClasses(importSpecs, CommandBuilder.class)) {
  //System.out.println("found " + clazz);
 }
 MorphlineContext ctx = new MorphlineContext.Builder().build(); 
 ctx.importCommandBuilders(importSpecs);
 ctx.importCommandBuilders(importSpecs);    
}

origin: kite-sdk/kite

@Test
public void testImportSpecsWithOnlyFQCNs() {
 List<String> importSpecs = Arrays.asList(getClass().getName());
 for (Class clazz : new MorphlineContext().getTopLevelClasses(importSpecs, CommandBuilder.class)) {
  //System.out.println("found " + clazz);
 }
 MorphlineContext ctx = new MorphlineContext.Builder().build(); 
 ctx.importCommandBuilders(importSpecs);
 ctx.importCommandBuilders(importSpecs);    
}

org.kitesdk.morphline.apiMorphlineContextgetTopLevelClasses

Javadoc

Returns all classes that implement the given interface and are contained in a Java package or its subpackages (importSpec ends with ".**"), or are contained in the given Java package (importSpec ends with ".*"), or are a Java class with the given fully qualified class name (importSpec ends otherwise). Uses a shaded version of com.google.guava.reflect-14.0.1 to enable running with prior versions of guava without issues.

Popular methods of MorphlineContext

  • getMetricRegistry
  • getExceptionHandler
  • <init>
    For public access use Builder#build() instead
  • getHealthCheckRegistry
  • getSettings
  • getTypedSettings
  • importCommandBuilders
  • addClass
  • getClassLoaders
  • getCommandBuilder

Popular in Java

  • Finding current android device location
  • startActivity (Activity)
  • getExternalFilesDir (Context)
  • compareTo (BigDecimal)
    Compares this BigDecimal with the specified BigDecimal. Two BigDecimal objects that are equal in val
  • MalformedURLException (java.net)
    Thrown to indicate that a malformed URL has occurred. Either no legal protocol could be found in a s
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • TreeMap (java.util)
    A Red-Black tree based NavigableMap implementation. The map is sorted according to the Comparable of
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now