Beispiel #1
0
  /**
   * Creates a new instance of JcaSystem
   *
   * @param contextName one of "com.cosylab.epics.caj.CAJContext",
   *     "gov.aps.jca.jni.ThreadSafeContext" or "gov.aps.jca.jni.SingleThreadedContext"
   */
  public JcaSystem(final String contextName) {
    try {
      JCA_LIBRARY = JCALibrary.getInstance();

      final String contextType = (contextName != null) ? contextName : defaultJCAContextType();
      JCA_CONTEXT = JCA_LIBRARY.createContext(contextType);
    } catch (CAException exception) {
      exception.printStackTrace();
    }
  }
Beispiel #2
0
  /**
   * Initialize JCA context.
   *
   * @throws CAException throws on any failure.
   */
  private void initialize() throws CAException {

    // Get the JCALibrary instance.
    JCALibrary jca = JCALibrary.getInstance();

    // Create a context with default configuration values.
    context = jca.createContext(JCALibrary.JNI_THREAD_SAFE);

    // Display basic information about the context.
    System.out.println(context.getVersion().getVersionString());
    context.printInfo();
    System.out.println();
  }
  static {
    EpicsPlugin plugin = EpicsPlugin.getDefault();

    boolean use_pure_java = plugin.usePureJava();
    paramClassName = use_pure_java ? JCALibrary.CHANNEL_ACCESS_JAVA : JCALibrary.JNI_THREAD_SAFE;
    paramMask = plugin.getMonitorMask().getMask();
    dbePropertySupported = plugin.isDbePropertySupported();
    honorZeroPrecision = plugin.isHonorZeroPrecision();
    rtypValueOnly = plugin.isRtypValueOnly();
    varArraySupported = plugin.getVarArraySupported();
    log.config("Loading epics data source parameters: " + paramClassName + " - " + paramMask);
    JCALibrary jca = JCALibrary.getInstance();
    try {
      context = jca.createContext(paramClassName);
    } catch (CAException ex) {
      log.log(Level.SEVERE, "Couldn't create JCA context", ex);
    }
  }