Tabnine Logo
Embedder
Code IndexAdd Tabnine to your IDE (free)

How to use
Embedder
in
org.apache.openejb.loader

Best Java code snippets using org.apache.openejb.loader.Embedder (Showing top 14 results out of 315)

origin: org.apache.geronimo.ext.openejb/openejb-loader

private void checkOpenEjbHome(File openejbHome) throws Exception {
  try {
    String homePath = openejbHome.getAbsolutePath();
    // The openejb.home must exist
    if (!openejbHome.exists())
      handleError(BAD_HOME + homePath, NOT_THERE, INSTRUCTIONS);
    // The openejb.home must be a directory
    if (!openejbHome.isDirectory())
      handleError(BAD_HOME + homePath, NOT_DIRECTORY, INSTRUCTIONS);
    // The openejb.home must contain a 'lib' directory
    File openejbHomeLibs = new File(openejbHome, "lib");
    if (!openejbHomeLibs.exists())
      handleError(BAD_HOME + homePath, NO_LIBS, INSTRUCTIONS);
    // The openejb.home there must be openejb*.jar files in the 'dist'
    // directory
    String[] libs = openejbHomeLibs.list();
    boolean found = false;
    for (int i = 0; i < libs.length && !found; i++) {
      found = (libs[i].startsWith("openejb-") && libs[i].endsWith(".jar"));
    }
    if (!found)
      handleError(BAD_HOME + homePath, NO_LIBS, INSTRUCTIONS);
  } catch (Exception e) {
    e.printStackTrace();
  }
}
origin: org.apache.tomee/openejb-loader

/**
 * Uses reflection to invoke the init(Properties props) method on the loaderClass field
 *
 * @param properties
 * @return
 * @throws Exception
 */
public Object init(final Properties properties) throws Exception {
  final Class loaderClass = load();
  try {
    // get the init method
    final Method init = loaderClass.getMethod("init", Properties.class);
    // create the instance
    final Object instance = loaderClass.newInstance();
    // invoke init method
    final Object value = init.invoke(instance, properties);
    return value;
  } catch (final NoSuchMethodException e) {
    throw (IllegalStateException) new IllegalStateException("Signatures for Loader are no longer correct.").initCause(e);
  } catch (final InvocationTargetException e) {
    final Throwable cause = e.getCause();
    if (cause instanceof Error) {
      throw (Error) cause;
    } else {
      throw (Exception) cause;
    }
  }
}
origin: org.apache.openejb/openejb-tomcat-loader

  Embedder embedder = new Embedder("org.apache.openejb.tomcat.catalina.TomcatLoader");
  embedder.init(properties);
} catch (Exception e) {
  e.printStackTrace();
origin: org.apache.openejb/openejb-loader

/**
 * Loads the Class object for the className.
 *
 * @return
 * @throws Exception
 */
public Class load() throws Exception {
  if (loaderClass == null) {
    final ClassPath classPath = SystemInstance.get().getClassPath();
    final ClassLoader classLoader = classPath.getClassLoader();
    try {
      loaderClass = classLoader.loadClass(className);
    } catch (final Exception e) {
      loaderClass = forcefulLoad(classPath, classLoader);
    }
  }
  return loaderClass;
}
origin: org.apache.geronimo.ext.openejb/openejb-loader

private Class forcefulLoad(ClassPath classPath, ClassLoader classLoader) throws Exception {
  try {
    File libsDir;
    String libsPath = SystemInstance.get().getProperty("openejb.libs");
    if (libsPath != null){
      libsDir = new File(libsPath);
    } else {
      checkOpenEjbHome(SystemInstance.get().getHome().getDirectory());
      FileUtils home = SystemInstance.get().getHome();
      libsDir = home.getDirectory("lib");
    }
    classPath.addJarsToPath(libsDir);
  } catch (Exception e2) {
    throw new Exception("Could not load OpenEJB libraries. Exception: " + e2.getClass().getName() + " " + e2.getMessage());
  }
  try {
    return classLoader.loadClass(className);
  } catch (Exception e2) {
    throw new Exception("Could not load class '"+className+"' after embedding libraries. Exception: " + e2.getClass().getName() + " " + e2.getMessage());
  }
}
origin: org.apache.tomee/tomee-loader

final Embedder embedder = new Embedder("org.apache.tomee.catalina.TomcatLoader");
SystemInstance.get().setComponent(Embedder.class, embedder);
try {
  embedder.init(properties);
} catch (final Exception e) {
  e.printStackTrace();
origin: org.apache.tomee/openejb-loader

/**
 * Loads the Class object for the className.
 *
 * @return
 * @throws Exception
 */
public Class load() throws Exception {
  if (loaderClass == null) {
    final ClassPath classPath = SystemInstance.get().getClassPath();
    final ClassLoader classLoader = classPath.getClassLoader();
    try {
      loaderClass = classLoader.loadClass(className);
    } catch (final Exception e) {
      loaderClass = forcefulLoad(classPath, classLoader);
    }
  }
  return loaderClass;
}
origin: org.apache.openejb/openejb-loader

  libsDir = new File(libsPath);
} else {
  checkOpenEjbHome(SystemInstance.get().getHome().getDirectory());
  final FileUtils home = SystemInstance.get().getHome();
  libsDir = home.getDirectory("lib");
origin: org.apache.geronimo.ext.openejb/openejb-loader

/**
 * Loads the Class object for the className.
 * @return
 * @throws Exception
 */
public Class load() throws Exception {
  if (loaderClass == null) {
    ClassPath classPath = SystemInstance.get().getClassPath();
    ClassLoader classLoader = classPath.getClassLoader();
    try {
      loaderClass = classLoader.loadClass(className);
    } catch (Exception e) {
      loaderClass = forcefulLoad(classPath, classLoader);
    }
  }
  return loaderClass;
}
/**
origin: org.apache.tomee/openejb-loader

  libsDir = new File(libsPath);
} else {
  checkOpenEjbHome(SystemInstance.get().getHome().getDirectory());
  final FileUtils home = SystemInstance.get().getHome();
  libsDir = home.getDirectory("lib");
origin: org.apache.geronimo.ext.openejb/openejb-loader

/**
 * Uses reflection to invoke the init(Properties props) method on the loaderClass field
 * @param properties
 * @return
 * @throws Exception
 */
public Object init(Properties properties) throws Exception {
  Class loaderClass = load();
  try {
    // get the init method
    Method init = loaderClass.getMethod("init", Properties.class);
    // create the instance
    Object instance = loaderClass.newInstance();
    // invoke init method
    Object value = init.invoke(instance, properties);
    return value;
  } catch (NoSuchMethodException e) {
    throw (IllegalStateException) new IllegalStateException("Signatures for Loader are no longer correct.").initCause(e);
  } catch (InvocationTargetException e) {
    Throwable cause = e.getCause();
    if (cause instanceof Error) {
      throw (Error) cause;
    } else {
      throw (Exception) cause;
    }
  }
}
origin: org.apache.openejb/openejb-loader

private void checkOpenEjbHome(final File openejbHome) throws Exception {
  try {
    final String homePath = openejbHome.getAbsolutePath();
    // The openejb.home must exist
    if (!openejbHome.exists()) {
      handleError(BAD_HOME + homePath, NOT_THERE, INSTRUCTIONS);
    }
    // The openejb.home must be a directory
    if (!openejbHome.isDirectory()) {
      handleError(BAD_HOME + homePath, NOT_DIRECTORY, INSTRUCTIONS);
    }
    // The openejb.home must contain a 'lib' directory
    final File openejbHomeLibs = new File(openejbHome, "lib");
    if (!openejbHomeLibs.exists()) {
      handleError(BAD_HOME + homePath, NO_LIBS, INSTRUCTIONS);
    }
    // The openejb.home there must be openejb*.jar files in the 'dist'
    // directory
    final String[] libs = openejbHomeLibs.list();
    boolean found = false;
    for (int i = 0; i < libs.length && !found; i++) {
      found = (libs[i].startsWith("openejb-") && libs[i].endsWith(".jar"));
    }
    if (!found) {
      handleError(BAD_HOME + homePath, NO_LIBS, INSTRUCTIONS);
    }
  } catch (final Exception e) {
    e.printStackTrace();
  }
}
origin: org.apache.openejb/openejb-loader

/**
 * Uses reflection to invoke the init(Properties props) method on the loaderClass field
 *
 * @param properties
 * @return
 * @throws Exception
 */
public Object init(final Properties properties) throws Exception {
  final Class loaderClass = load();
  try {
    // get the init method
    final Method init = loaderClass.getMethod("init", Properties.class);
    // create the instance
    final Object instance = loaderClass.newInstance();
    // invoke init method
    final Object value = init.invoke(instance, properties);
    return value;
  } catch (final NoSuchMethodException e) {
    throw (IllegalStateException) new IllegalStateException("Signatures for Loader are no longer correct.").initCause(e);
  } catch (final InvocationTargetException e) {
    final Throwable cause = e.getCause();
    if (cause instanceof Error) {
      throw (Error) cause;
    } else {
      throw (Exception) cause;
    }
  }
}
origin: org.apache.tomee/openejb-loader

private void checkOpenEjbHome(final File openejbHome) throws Exception {
  try {
    final String homePath = openejbHome.getAbsolutePath();
    // The openejb.home must exist
    if (!openejbHome.exists()) {
      handleError(BAD_HOME + homePath, NOT_THERE, INSTRUCTIONS);
    }
    // The openejb.home must be a directory
    if (!openejbHome.isDirectory()) {
      handleError(BAD_HOME + homePath, NOT_DIRECTORY, INSTRUCTIONS);
    }
    // The openejb.home must contain a 'lib' directory
    final File openejbHomeLibs = new File(openejbHome, "lib");
    if (!openejbHomeLibs.exists()) {
      handleError(BAD_HOME + homePath, NO_LIBS, INSTRUCTIONS);
    }
    // The openejb.home there must be openejb*.jar files in the 'dist'
    // directory
    final String[] libs = openejbHomeLibs.list();
    boolean found = false;
    for (int i = 0; i < libs.length && !found; i++) {
      found = (libs[i].startsWith("openejb-") && libs[i].endsWith(".jar"));
    }
    if (!found) {
      handleError(BAD_HOME + homePath, NO_LIBS, INSTRUCTIONS);
    }
  } catch (final Exception e) {
    e.printStackTrace();
  }
}
org.apache.openejb.loaderEmbedder

Most used methods

  • checkOpenEjbHome
  • forcefulLoad
  • handleError
  • load
    Loads the Class object for the className.
  • <init>
  • init
    Uses reflection to invoke the init(Properties props) method on the loaderClass field

Popular in Java

  • Reactive rest calls using spring rest template
  • startActivity (Activity)
  • getSupportFragmentManager (FragmentActivity)
  • compareTo (BigDecimal)
  • InputStreamReader (java.io)
    A class for turning a byte stream into a character stream. Data read from the source input stream is
  • Comparator (java.util)
    A Comparator is used to compare two objects to determine their ordering with respect to each other.
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • JOptionPane (javax.swing)
  • StringUtils (org.apache.commons.lang)
    Operations on java.lang.String that arenull safe. * IsEmpty/IsBlank - checks if a String contains
  • IsNull (org.hamcrest.core)
    Is the value null?
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now