Example #1
1
  /**
   * Return the value for a given name from the System Properties or the Environmental Variables.
   * The former overrides the latter.
   *
   * @param name - the name of the System Property or Environmental Variable
   * @return the value of the variable or null if it was not found
   */
  public static String getEnvOrProp(String name) {
    // System properties override env. variables
    String envVal = System.getenv(name);
    String sysPropVal = System.getProperty(name);

    if (sysPropVal != null) return sysPropVal;

    return envVal;
  }
Example #2
1
 private static ClassLoader toolsClassLoader() {
   File javaHome = new File(System.getProperty("java.home"));
   File classesDir = new File(javaHome, "classes");
   File libDir = new File(javaHome.getParentFile(), "lib");
   File toolsJar = new File(libDir, "tools.jar");
   try {
     return new URLClassLoader(new URL[] {classesDir.toURL(), toolsJar.toURL()});
   } catch (MalformedURLException e) {
     throw new AssertionError(e);
   }
 }
    // Creates a new thread, runs the program in that thread, and reports any errors as needed.
    private void run(String clazz) {
      try {
        // Makes sure the JVM resets if it's already running.
        if (JVMrunning) kill();

        // Some String constants for java path and OS-specific separators.
        String separator = System.getProperty("file.separator");
        String path = System.getProperty("java.home") + separator + "bin" + separator + "java";

        // Tries to run compiled code.
        ProcessBuilder builder = new ProcessBuilder(path, clazz);

        // Should be good now! Everything past this is on you. Don't mess it up.
        println(
            "Build succeeded on " + java.util.Calendar.getInstance().getTime().toString(), progErr);
        println("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~", progErr);

        JVM = builder.start();

        // Note that as of right now, there is no support for input. Only output.
        Reader errorReader = new InputStreamReader(JVM.getErrorStream());
        Reader outReader = new InputStreamReader(JVM.getInputStream());
        // Writer inReader = new OutputStreamWriter(JVM.getOutputStream());

        redirectErr = redirectIOStream(errorReader, err);
        redirectOut = redirectIOStream(outReader, out);
        // redirectIn = redirectIOStream(null, inReader);
      } catch (Exception e) {
        // This catches any other errors we might get.
        println("Some error thrown", progErr);
        logError(e.toString());
        displayLog();
        return;
      }
    }
  public static void testNSS(PKCS11Test test) throws Exception {
    if (!(new File(NSS_BASE)).exists()) return;

    String libdir = getNSSLibDir();
    if (libdir == null) {
      return;
    }

    if (loadNSPR(libdir) == false) {
      return;
    }

    String libfile = libdir + System.mapLibraryName("softokn3");

    String customDBdir = System.getProperty("CUSTOM_DB_DIR");
    String dbdir = (customDBdir != null) ? customDBdir : NSS_BASE + SEP + "db";
    // NSS always wants forward slashes for the config path
    dbdir = dbdir.replace('\\', '/');

    String customConfig = System.getProperty("CUSTOM_P11_CONFIG");
    String customConfigName = System.getProperty("CUSTOM_P11_CONFIG_NAME", "p11-nss.txt");
    String p11config = (customConfig != null) ? customConfig : NSS_BASE + SEP + customConfigName;

    System.setProperty("pkcs11test.nss.lib", libfile);
    System.setProperty("pkcs11test.nss.db", dbdir);
    Provider p = getSunPKCS11(p11config);
    test.premain(p);
  }
Example #5
0
 private ClassLoaderStrategy getClassLoaderStrategy(String fullyQualifiedClassName)
     throws Exception {
   try {
     // Get just the package name
     StringBuffer sb = new StringBuffer(fullyQualifiedClassName);
     sb.delete(sb.lastIndexOf("."), sb.length());
     currentPackage = sb.toString();
     // Retrieve the Java classpath from the system properties
     String cp = System.getProperty("java.class.path");
     String sepChar = System.getProperty("path.separator");
     String[] paths = StringUtils.pieceList(cp, sepChar.charAt(0));
     ClassLoaderStrategy cl =
         ClassLoaderUtil.getClassLoader(ClassLoaderUtil.FILE_SYSTEM_CLASS_LOADER, new String[] {});
     // Iterate through paths until class with the specified name is found
     String classpath = StringUtils.replaceChar(currentPackage, '.', File.separatorChar);
     for (int i = 0; i < paths.length; i++) {
       Class[] classes = cl.getClasses(paths[i] + File.separatorChar + classpath, currentPackage);
       for (int j = 0; j < classes.length; j++) {
         if (classes[j].getName().equals(fullyQualifiedClassName)) {
           return ClassLoaderUtil.getClassLoader(
               ClassLoaderUtil.FILE_SYSTEM_CLASS_LOADER, new String[] {paths[i]});
         }
       }
     }
     throw new Exception("Class could not be found.");
   } catch (Exception e) {
     System.err.println("Exception creating class loader strategy.");
     System.err.println(e.getMessage());
     throw e;
   }
 }
Example #6
0
  /**
   * 'handler' can be of any type that implements 'exportedInterface', but only methods declared by
   * the interface (and its superinterfaces) will be invocable.
   */
  public <T> InAppServer(
      String name,
      String portFilename,
      InetAddress inetAddress,
      Class<T> exportedInterface,
      T handler) {
    this.fullName = name + "Server";
    this.exportedInterface = exportedInterface;
    this.handler = handler;

    // In the absence of authentication, we shouldn't risk starting a server as root.
    if (System.getProperty("user.name").equals("root")) {
      Log.warn(
          "InAppServer: refusing to start unauthenticated server \"" + fullName + "\" as root!");
      return;
    }

    try {
      File portFile = FileUtilities.fileFromString(portFilename);
      secretFile = new File(portFile.getPath() + ".secret");
      Thread serverThread = new Thread(new ConnectionAccepter(portFile, inetAddress), fullName);
      // If there are no other threads left, the InApp server shouldn't keep us alive.
      serverThread.setDaemon(true);
      serverThread.start();
    } catch (Throwable th) {
      Log.warn("InAppServer: couldn't start \"" + fullName + "\".", th);
    }
    writeNewSecret();
  }
 private byte[] loadClassData(String className) throws IOException {
   Playground.println("Loading class " + className + ".class", warning);
   File f = new File(System.getProperty("user.dir") + "/" + className + ".class");
   byte[] b = new byte[(int) f.length()];
   new FileInputStream(f).read(b);
   return b;
 }
Example #8
0
 // added by W. Christian
 static {
   try { // system properties may not be readable in some environments
     NEW_LINE = System.getProperty("line.separator", "/n"); // $NON-NLS-1$ //$NON-NLS-2$
   } catch (SecurityException ex) {
     /** empty block */
   }
 }
Example #9
0
  void enableLionFS() {
    try {
      String version = System.getProperty("os.version");
      String[] tokens = version.split("\\.");
      int major = Integer.parseInt(tokens[0]), minor = 0;
      if (tokens.length > 1) minor = Integer.parseInt(tokens[1]);
      if (major < 10 || (major == 10 && minor < 7))
        throw new Exception("Operating system version is " + version);

      Class fsuClass = Class.forName("com.apple.eawt.FullScreenUtilities");
      Class argClasses[] = new Class[] {Window.class, Boolean.TYPE};
      Method setWindowCanFullScreen = fsuClass.getMethod("setWindowCanFullScreen", argClasses);
      setWindowCanFullScreen.invoke(fsuClass, this, true);

      Class fsListenerClass = Class.forName("com.apple.eawt.FullScreenListener");
      InvocationHandler fsHandler = new MyInvocationHandler(cc);
      Object proxy =
          Proxy.newProxyInstance(
              fsListenerClass.getClassLoader(), new Class[] {fsListenerClass}, fsHandler);
      argClasses = new Class[] {Window.class, fsListenerClass};
      Method addFullScreenListenerTo = fsuClass.getMethod("addFullScreenListenerTo", argClasses);
      addFullScreenListenerTo.invoke(fsuClass, this, proxy);

      canDoLionFS = true;
    } catch (Exception e) {
      vlog.debug("Could not enable OS X 10.7+ full-screen mode:");
      vlog.debug("  " + e.toString());
    }
  }
Example #10
0
 private static File securityPropFile(String filename) {
   // maybe check for a system property which will specify where to
   // look. Someday.
   String sep = File.separator;
   return new File(
       System.getProperty("java.home") + sep + "lib" + sep + "security" + sep + filename);
 }
Example #11
0
 public static void testDeimos(PKCS11Test test) throws Exception {
   if (new File("/opt/SUNWconn/lib/libpkcs11.so").isFile() == false
       || "true".equals(System.getProperty("NO_DEIMOS"))) {
     return;
   }
   if (!(new File(NSS_BASE)).exists()) return;
   String p11config = NSS_BASE + SEP + "p11-deimos.txt";
   Provider p = getSunPKCS11(p11config);
   test.premain(p);
 }
Example #12
0
  public static void premain(String args, Instrumentation inst) throws Exception {
    try {
      String[] agentArgs;
      if (args == null) agentArgs = new String[] {""};
      else agentArgs = args.split(",");
      if (!agentArgs[0].equals("instrumenting")) jarFileName = agentArgs[0];
      BaseClassTransformer rct = null;
      rct = new BaseClassTransformer();
      if (agentArgs[0].equals("instrumenting")) {
        initVMClasses = new HashSet<String>();
        for (Class<?> c : inst.getAllLoadedClasses()) {
          ((Set<String>) initVMClasses).add(c.getName());
        }
      }
      if (!agentArgs[0].equals("instrumenting")) {

        inst.addTransformer(rct);
        Tracer.setLocals(new CounterThreadLocal());
        Tracer.overrideAll(true);
        for (Class<?> c : inst.getAllLoadedClasses()) {
          try {
            if (c.isInterface()) continue;
            if (c.isArray()) continue;
            byte[] bytes = rct.getBytes(c.getName());
            if (bytes == null) {
              continue;
            }
            inst.redefineClasses(new ClassDefinition[] {new ClassDefinition(c, bytes)});
          } catch (Throwable e) {
            synchronized (System.err) {
              System.err.println("" + c + " failed...");
              e.printStackTrace();
            }
          }
        }
        Runtime.getRuntime()
            .addShutdownHook(
                new Thread() {
                  public void run() {
                    Tracer.mark();
                    try {
                      PrintStream ps = new PrintStream("bailout.txt");
                      ps.println("Bailouts: " + Tracer.getBailoutCount());
                      ps.close();
                    } catch (Exception e) {
                    }
                    Tracer.unmark();
                  }
                });
        if ("true".equals(System.getProperty("bci.observerOn"))) Tracer.overrideAll(false);
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
  /* We look for System property sun.jvm.hotspot.jdi.<vm version>.
   * This property should have the value of JDK HOME directory for
   * the given <vm version>.
   */
  private static String getSAClassPathForVM(String vmVersion) {
    final String prefix = "sun.jvm.hotspot.jdi.";
    // look for exact match of VM version
    String jvmHome = System.getProperty(prefix + vmVersion);
    if (DEBUG) {
      System.out.println("looking for System property " + prefix + vmVersion);
    }

    if (jvmHome == null) {
      // omit chars after first '-' in VM version and try
      // for example, in '1.5.0-b55' we take '1.5.0'
      int index = vmVersion.indexOf('-');
      if (index != -1) {
        vmVersion = vmVersion.substring(0, index);
        if (DEBUG) {
          System.out.println("looking for System property " + prefix + vmVersion);
        }
        jvmHome = System.getProperty(prefix + vmVersion);
      }

      if (jvmHome == null) {
        // System property is not set
        if (DEBUG) {
          System.out.println("can't locate JDK home for " + vmVersion);
        }
        return null;
      }
    }

    if (DEBUG) {
      System.out.println("JDK home for " + vmVersion + " is " + jvmHome);
    }

    // sa-jdi is in $JDK_HOME/lib directory
    StringBuffer buf = new StringBuffer();
    buf.append(jvmHome);
    buf.append(File.separatorChar);
    buf.append("lib");
    buf.append(File.separatorChar);
    buf.append("sa-jdi.jar");
    return buf.toString();
  }
Example #14
0
    /** Constructs a VerifyClassLoader. It scans the class path and the excluded package paths */
    public VerifyClassLoader() {
      super();
      String classPath = System.getProperty("java.class.path");
      String separator = System.getProperty("path.separator");

      // first pass: count elements
      StringTokenizer st = new StringTokenizer(classPath, separator);
      int i = 0;
      while (st.hasMoreTokens()) {
        st.nextToken();
        i++;
      }
      // second pass: split
      fPathItems = new String[i];
      st = new StringTokenizer(classPath, separator);
      i = 0;
      while (st.hasMoreTokens()) {
        fPathItems[i++] = st.nextToken();
      }
    }
Example #15
0
File: Macro.java Project: bramk/bnd
  protected String replace(String key, Link link) {
    if (link != null && link.contains(key)) return "${infinite:" + link.toString() + "}";

    if (key != null) {
      key = key.trim();
      if (key.length() > 0) {
        Processor source = domain;
        String value = null;

        if (key.indexOf(';') < 0) {
          Instruction ins = new Instruction(key);
          if (!ins.isLiteral()) {
            SortedList<String> sortedList = SortedList.fromIterator(domain.iterator());
            StringBuilder sb = new StringBuilder();
            String del = "";
            for (String k : sortedList) {
              if (ins.matches(k)) {
                String v = replace(k, new Link(source, link, key));
                if (v != null) {
                  sb.append(del);
                  del = ",";
                  sb.append(v);
                }
              }
            }
            return sb.toString();
          }
        }
        while (value == null && source != null) {
          value = source.getProperties().getProperty(key);
          source = source.getParent();
        }

        if (value != null) return process(value, new Link(source, link, key));

        value = doCommands(key, link);
        if (value != null) return process(value, new Link(source, link, key));

        if (key != null && key.trim().length() > 0) {
          value = System.getProperty(key);
          if (value != null) return value;
        }
        if (!flattening && !key.equals("@"))
          domain.warning("No translation found for macro: " + key);
      } else {
        domain.warning("Found empty macro key");
      }
    } else {
      domain.warning("Found null macro key");
    }
    return "${" + key + "}";
  }
 public static String getHomePath() {
   String home = System.getProperty("HOME");
   if (home == null) {
     try {
       String thisPath = SystemUtils.class.getResource("SystemUtils.class").getPath();
       String thisPkg = SystemUtils.class.getPackage().getName();
       home = thisPath.substring(0, thisPath.indexOf(thisPkg.substring(0, thisPkg.indexOf('.'))));
     } catch (Exception e) {
       e.printStackTrace();
     }
   }
   if (home == null) home = "";
   return home;
 }
 public String getClasspath() {
   final StringBuilder sb = new StringBuilder();
   boolean firstPass = true;
   final Enumeration<File> componentEnum = this.pathComponents.elements();
   while (componentEnum.hasMoreElements()) {
     if (!firstPass) {
       sb.append(System.getProperty("path.separator"));
     } else {
       firstPass = false;
     }
     sb.append(componentEnum.nextElement().getAbsolutePath());
   }
   return sb.toString();
 }
Example #18
0
  public static void testDefault(PKCS11Test test) throws Exception {
    // run test for default configured PKCS11 providers (if any)

    if ("true".equals(System.getProperty("NO_DEFAULT"))) {
      return;
    }

    Provider[] providers = Security.getProviders();
    for (int i = 0; i < providers.length; i++) {
      Provider p = providers[i];
      if (p.getName().startsWith("SunPKCS11-")) {
        test.premain(p);
      }
    }
  }
Example #19
0
 // security check to see whether the caller can perform attach
 private void checkProcessAttach(int pid) {
   SecurityManager sm = System.getSecurityManager();
   if (sm != null) {
     String os = System.getProperty("os.name");
     try {
       // Whether the caller can perform link against SA native library?
       checkNativeLink(sm, os);
       if (os.equals("SunOS") || os.equals("Linux")) {
         // Whether the caller can read /proc/<pid> file?
         sm.checkRead("/proc/" + pid);
       }
     } catch (SecurityException se) {
       throw new SecurityException("permission denied to attach to " + pid);
     }
   }
 }
Example #20
0
 public static String getBase() throws Exception {
   if (PKCS11_BASE != null) {
     return PKCS11_BASE;
   }
   File cwd = new File(System.getProperty("test.src", ".")).getCanonicalFile();
   while (true) {
     File file = new File(cwd, "TEST.ROOT");
     if (file.isFile()) {
       break;
     }
     cwd = cwd.getParentFile();
     if (cwd == null) {
       throw new Exception("Test root directory not found");
     }
   }
   PKCS11_BASE = new File(cwd, PKCS11_REL_PATH.replace('/', SEP)).getAbsolutePath();
   return PKCS11_BASE;
 }
  // The default constructor
  public CrownCounselIndexGetList_Access() {
    String traceProp = null;
    if ((traceProp = System.getProperty(HOSTPUBLISHER_ACCESSBEAN_TRACE)) != null) {
      try {
        Class c = Class.forName(HOSTPUBLISHER_ACCESSTRACE_OBJECT);
        Method m = c.getMethod("getInstance", null);
        o = m.invoke(null, null);
        Class parmTypes[] = {String.class};
        m = c.getMethod("initTrace", parmTypes);
        Object initTraceArgs[] = {traceProp};
        BitSet tracingBS = (BitSet) m.invoke(o, initTraceArgs);
        Class parmTypes2[] = {Object.class, String.class};
        traceMethod = c.getMethod("trace", parmTypes2);
        tracing = tracingBS.get(HOSTPUBLISHER_ACCESSBEAN_TRACING);
        Class parmTypes3[] = {String.class, HttpSession.class};
        auditMethod = c.getMethod("audit", parmTypes3);
        auditing = tracingBS.get(HOSTPUBLISHER_ACCESSBEAN_AUDITING);
      } catch (Exception e) {
        // no tracing will be done
        System.err.println(
            (new Date(System.currentTimeMillis())).toString()
                + " hostpublisher.accessbean.trace="
                + traceProp
                + ", Exception="
                + e.toString());
      }
    }

    if (tracing == true) {
      traceArgs[0] = this;
      traceArgs[1] = " CrownCounselIndexGetList_Access()";
      try {
        traceMethod.invoke(o, traceArgs);
      } catch (Exception x) {
        System.err.println(
            (new Date(System.currentTimeMillis())).toString()
                + " traceMethod.invoke(null, traceArgs)"
                + ", Exception="
                + x.toString());
      }
    }
    inputProps = new CrownCounselIndexGetList_Properties();
    return;
  }
Example #22
0
  private void setupFlavors() {
    //  If it's NOT Windows
    _windows = System.getProperty("os.name").indexOf("indows") != -1;

    //  Deprecated, generally unused, but deprecation didn't provide
    // a useful alternative w/o rewriting a lot of code, so I'm keeping it for now.
    if (_plainFlavor == null) {
      //      _plainFlavor = DataFlavor.plainTextFlavor;
      _plainFlavor = DataFlavor.getTextPlainUnicodeFlavor();
    }

    _isoFlavor = getDataFlavor(_isoFlavor, "isoFlavor");
    _ascFlavor = getDataFlavor(_ascFlavor, "ascFlavor");
    _pl2Flavor = getDataFlavor(_pl2Flavor, "pl2Flavor");
    _htmlFlavor = getDataFlavor(_htmlFlavor, "htmlFlavor");
    _utf8HtmlFlavor = getDataFlavor(_htmlFlavor, "UTF8Html");
    _thtmlFlavor = getDataFlavor(_htmlFlavor, "thtmlFlavor");
    _urlFlavor = getDataFlavor(_urlFlavor, "urlFlavor");
  }
 public void run() {
   try {
     if (myPreviousThread != null) myPreviousThread.join();
     Thread.sleep(delay);
     log("> run MouseWheelThread " + amount);
     while (!hasFocus()) {
       Thread.sleep(1000);
     }
     int dir = 1;
     if (System.getProperty("os.name").toUpperCase().indexOf("MAC") != -1) {
       // yay for Apple
       dir = -1;
     }
     robot.setAutoDelay(Math.max(duration / Math.abs(amount), 1));
     for (int i = 0; i < Math.abs(amount); i++) {
       robot.mouseWheel(amount > 0 ? dir : -dir);
     }
     robot.setAutoDelay(1);
   } catch (Exception e) {
     log("Bad parameters passed to mouseWheel");
     e.printStackTrace();
   }
   log("< run MouseWheelThread ");
 }
/** The EJB client's class */
public class CrownCounselIndexGetList_Access implements Runnable {

  // local variables used for tracing
  private static final String HOSTPUBLISHER_ACCESSBEAN_TRACE = "hostpublisher.accessbean.trace";
  private static final String HOSTPUBLISHER_ACCESSTRACE_OBJECT = "AccessEJBTrace";
  private static final int HOSTPUBLISHER_ACCESSBEAN_TRACING = 0;
  private static final int HOSTPUBLISHER_ACCESSBEAN_AUDITING = 1;
  private boolean tracing = false;
  private boolean auditing = false;
  private Method traceMethod;
  private Method auditMethod;
  private Object traceArgs[] = new Object[2];
  private Object auditArgs[] = new Object[2];
  private Object o;

  // local variables used for ejb objects
  private HPubEJB2Home ejbHome = null;
  private HPubEJB2 ejb = null;

  // zos platform does not allow ejb remove from finalize method.
  // a System property is queried to determine how ejb remove should be processed
  private String zosRuntime = System.getProperty("hostpublisher.jvm.zosruntime");

  // prefix of key used for saving access handle with HttpSessionBindingListener object.
  // start/end chain name of IO's in chain is appended to form actual key.
  // note total length of key must be <= 24 chars (required for WAS session persistence).
  // this leaves up to 16 chars for chain name.
  private static final String KEY_WEBCONN = "c.i.h.e.";

  // local copies of HttpServletRequest and HttpServletResponse
  private HttpServletRequest oHttpServletRequest = null;
  private HttpServletResponse oHttpServletResponse = null;

  // name of the Integration Object to be processed
  private static final String hPubIOName = "IntegrationObject.CrownCounselIndexGetList";

  // list of listeners for RequestCompleteEvent
  Vector listenerList = new Vector();

  // local variables for input & output Properties objects
  CrownCounselIndexGetList_Properties inputProps = null;
  CrownCounselIndexGetList_Properties outputProps = null;

  // ejb accessHandle property
  javax.ejb.Handle hPubAccessHandle = null;

  // hPubLinkKey for use with IO chains
  String hPubLinkKey = null;

  // version number of this Access bean
  String hPubAccessBeanVersion = "EJB_1.1_AccessBean";

  // The default constructor
  public CrownCounselIndexGetList_Access() {
    String traceProp = null;
    if ((traceProp = System.getProperty(HOSTPUBLISHER_ACCESSBEAN_TRACE)) != null) {
      try {
        Class c = Class.forName(HOSTPUBLISHER_ACCESSTRACE_OBJECT);
        Method m = c.getMethod("getInstance", null);
        o = m.invoke(null, null);
        Class parmTypes[] = {String.class};
        m = c.getMethod("initTrace", parmTypes);
        Object initTraceArgs[] = {traceProp};
        BitSet tracingBS = (BitSet) m.invoke(o, initTraceArgs);
        Class parmTypes2[] = {Object.class, String.class};
        traceMethod = c.getMethod("trace", parmTypes2);
        tracing = tracingBS.get(HOSTPUBLISHER_ACCESSBEAN_TRACING);
        Class parmTypes3[] = {String.class, HttpSession.class};
        auditMethod = c.getMethod("audit", parmTypes3);
        auditing = tracingBS.get(HOSTPUBLISHER_ACCESSBEAN_AUDITING);
      } catch (Exception e) {
        // no tracing will be done
        System.err.println(
            (new Date(System.currentTimeMillis())).toString()
                + " hostpublisher.accessbean.trace="
                + traceProp
                + ", Exception="
                + e.toString());
      }
    }

    if (tracing == true) {
      traceArgs[0] = this;
      traceArgs[1] = " CrownCounselIndexGetList_Access()";
      try {
        traceMethod.invoke(o, traceArgs);
      } catch (Exception x) {
        System.err.println(
            (new Date(System.currentTimeMillis())).toString()
                + " traceMethod.invoke(null, traceArgs)"
                + ", Exception="
                + x.toString());
      }
    }
    inputProps = new CrownCounselIndexGetList_Properties();
    return;
  }

  // Generated getters

  public java.lang.String getHPubMacroMessage() {
    if (outputProps != null) return (outputProps.getHPubMacroMessage());
    else return (inputProps.getHPubMacroMessage());
  }

  public java.lang.String getCrownCounselIndexSearchList() {
    if (outputProps != null) return (outputProps.getCrownCounselIndexSearchList());
    else return (inputProps.getCrownCounselIndexSearchList());
  }

  public java.lang.String getHPubEndChainName() {
    if (outputProps != null) return (outputProps.getHPubEndChainName());
    else return (inputProps.getHPubEndChainName());
  }

  public java.lang.String getSurnameOut() {
    if (outputProps != null) return (outputProps.getSurnameOut());
    else return (inputProps.getSurnameOut());
  }

  public java.lang.String[] getCrownCounselIndexSearchListCrownType() {
    if (outputProps != null) return (outputProps.getCrownCounselIndexSearchListCrownType());
    else return (inputProps.getCrownCounselIndexSearchListCrownType());
  }

  public java.lang.String getCrownCounselIndexSearchListCrownType(int index) {
    if (outputProps != null) return (outputProps.getCrownCounselIndexSearchListCrownType(index));
    else return (inputProps.getCrownCounselIndexSearchListCrownType(index));
  }

  public java.lang.String getHPubXMLProperties() {
    if (outputProps != null) return (outputProps.getHPubXMLProperties());
    else return (inputProps.getHPubXMLProperties());
  }

  public java.lang.String[] getCrownCounselIndexSearchListCrownId() {
    if (outputProps != null) return (outputProps.getCrownCounselIndexSearchListCrownId());
    else return (inputProps.getCrownCounselIndexSearchListCrownId());
  }

  public java.lang.String getCrownCounselIndexSearchListCrownId(int index) {
    if (outputProps != null) return (outputProps.getCrownCounselIndexSearchListCrownId(index));
    else return (inputProps.getCrownCounselIndexSearchListCrownId(index));
  }

  public java.lang.String getHPubXMLPropertiesWithoutInvoking() {
    if (outputProps != null) return (outputProps.getHPubXMLPropertiesWithoutInvoking());
    else return (inputProps.getHPubXMLPropertiesWithoutInvoking());
  }

  public java.lang.String getHPubConnectionOverrides() {
    if (outputProps != null) return (outputProps.getHPubConnectionOverrides());
    else return (inputProps.getHPubConnectionOverrides());
  }

  public java.lang.String getReturnMessage() {
    if (outputProps != null) return (outputProps.getReturnMessage());
    else return (inputProps.getReturnMessage());
  }

  public int getHPubStartType() {
    if (outputProps != null) return (outputProps.getHPubStartType());
    else return (inputProps.getHPubStartType());
  }

  public java.lang.String getHPubStartPoolName() {
    if (outputProps != null) return (outputProps.getHPubStartPoolName());
    else return (inputProps.getHPubStartPoolName());
  }

  public java.lang.Exception getHPubErrorException() {
    if (outputProps != null) return (outputProps.getHPubErrorException());
    else return (inputProps.getHPubErrorException());
  }

  public java.lang.String getHPubBeanName() {
    if (outputProps != null) return (outputProps.getHPubBeanName());
    else return (inputProps.getHPubBeanName());
  }

  public int getHPubErrorOccurred() {
    if (outputProps != null) return (outputProps.getHPubErrorOccurred());
    else return (inputProps.getHPubErrorOccurred());
  }

  public java.lang.String getHPubErrorMessage() {
    if (outputProps != null) return (outputProps.getHPubErrorMessage());
    else return (inputProps.getHPubErrorMessage());
  }

  public java.lang.String getHPubScreenState() {
    if (outputProps != null) return (outputProps.getHPubScreenState());
    else return (inputProps.getHPubScreenState());
  }

  public java.lang.String getMore() {
    if (outputProps != null) return (outputProps.getMore());
    else return (inputProps.getMore());
  }

  public java.lang.String getHPubStartChainName() {
    if (outputProps != null) return (outputProps.getHPubStartChainName());
    else return (inputProps.getHPubStartChainName());
  }

  public java.lang.String getHPubOutputParmSuffix() {
    if (outputProps != null) return (outputProps.getHPubOutputParmSuffix());
    else return (inputProps.getHPubOutputParmSuffix());
  }

  public java.lang.String[] getCrownCounselIndexSearchListHomeLocation() {
    if (outputProps != null) return (outputProps.getCrownCounselIndexSearchListHomeLocation());
    else return (inputProps.getCrownCounselIndexSearchListHomeLocation());
  }

  public java.lang.String getCrownCounselIndexSearchListHomeLocation(int index) {
    if (outputProps != null) return (outputProps.getCrownCounselIndexSearchListHomeLocation(index));
    else return (inputProps.getCrownCounselIndexSearchListHomeLocation(index));
  }

  public java.lang.String[] getCrownCounselIndexSearchListHomeCourt() {
    if (outputProps != null) return (outputProps.getCrownCounselIndexSearchListHomeCourt());
    else return (inputProps.getCrownCounselIndexSearchListHomeCourt());
  }

  public java.lang.String getCrownCounselIndexSearchListHomeCourt(int index) {
    if (outputProps != null) return (outputProps.getCrownCounselIndexSearchListHomeCourt(index));
    else return (inputProps.getCrownCounselIndexSearchListHomeCourt(index));
  }

  public java.lang.String getHPubLinkKey() {
    if (outputProps != null) return (outputProps.getHPubLinkKey());
    else return (inputProps.getHPubLinkKey());
  }

  public java.lang.String getHPubBeanType() {
    if (outputProps != null) return (outputProps.getHPubBeanType());
    else return (inputProps.getHPubBeanType());
  }

  public java.lang.String[] getCrownCounselIndexSearchListName() {
    if (outputProps != null) return (outputProps.getCrownCounselIndexSearchListName());
    else return (inputProps.getCrownCounselIndexSearchListName());
  }

  public java.lang.String getCrownCounselIndexSearchListName(int index) {
    if (outputProps != null) return (outputProps.getCrownCounselIndexSearchListName(index));
    else return (inputProps.getCrownCounselIndexSearchListName(index));
  }

  public int getHPubEndType() {
    if (outputProps != null) return (outputProps.getHPubEndType());
    else return (inputProps.getHPubEndType());
  }

  public java.lang.String getHPubIOName() {
    return new String(hPubIOName);
  }

  public java.lang.Object getHPubAccessHandle() {
    return hPubAccessHandle;
  }

  public java.lang.String getHPubAccessBeanVersion() {
    return new String(hPubAccessBeanVersion);
  }

  // Generated setters.

  public void setHPubMacroMessage(java.lang.String value) {
    inputProps.setHPubMacroMessage(value);
  }

  public void setHPubEndChainName(java.lang.String value) {
    inputProps.setHPubEndChainName(value);
  }

  public void setHPubConnectionOverrides(java.lang.String value) {
    inputProps.setHPubConnectionOverrides(value);
  }

  public void setHPubStartType(int value) {
    inputProps.setHPubStartType(value);
  }

  public void setHPubStartPoolName(java.lang.String value) {
    inputProps.setHPubStartPoolName(value);
  }

  public void setHPubScreenState(java.lang.String value) {
    inputProps.setHPubScreenState(value);
  }

  public void setHPubStartChainName(java.lang.String value) {
    inputProps.setHPubStartChainName(value);
  }

  public void setHPubLinkKey(java.lang.String value) {
    inputProps.setHPubLinkKey(value);
  }

  public void setHPubEndType(int value) {
    inputProps.setHPubEndType(value);
  }

  // Generated execution methods

  public java.lang.String getHPubXMLProperties(java.lang.String value) {
    if (tracing == true) {
      traceArgs[0] = this;
      traceArgs[1] = "CrownCounselIndexGetList_Access.getHPubXMLProperties(String)";
      try {
        traceMethod.invoke(o, traceArgs);
      } catch (Exception x) {
      }
    }

    inputProps.setHPubStyleSheet(value);

    try {
      startHereCommon();
    } catch (BeanException e) {
      // remove the ejb instance if handle exists
      if (ejb != null) {
        try {
          ejb.remove();
        } catch (Exception x) {
        }
        ejb = null;
      }

      // go set error fields
      setupErrorFields(e);
    }
    if (outputProps != null) return outputProps.getHPubXMLData();
    else return null;
  }

  public void setHPubAccessHandle(java.lang.Object value) {
    hPubAccessHandle = (javax.ejb.Handle) value;
  }

  /** processing method invoked from a Web environment */
  public void doHPTransaction(HttpServletRequest req, HttpServletResponse resp)
      throws BeanException {
    oHttpServletRequest = req;
    oHttpServletResponse = resp;

    if (tracing == true) {
      traceArgs[0] = this;
      traceArgs[1] = " CrownCounselIndexGetList_Access.doHPTransaction()";
      try {
        traceMethod.invoke(o, traceArgs);
      } catch (Exception x) {
      }
    }

    try {
      startHereCommon();
    } catch (BeanException e) {
      // remove the ejb instance if handle exists
      if (ejb != null) {
        try {
          ejb.remove();
        } catch (Exception x) {
        }
        ejb = null;
      }

      // go set error fields
      setupErrorFields(e);

      throw e; // rethrow the exception.
    }
  }

  /** processing method invoked from application */
  public void processRequest() throws BeanException {
    if (tracing == true) {
      traceArgs[0] = this;
      traceArgs[1] = " CrownCounselIndexGetList_Access.processRequest()";
      try {
        traceMethod.invoke(o, traceArgs);
      } catch (Exception x) {
      }
    }

    try {
      startHereCommon();
    } catch (BeanException e) {
      // remove the ejb instance if handle exists
      if (ejb != null) {
        try {
          ejb.remove();
        } catch (Exception x) {
        }
        ejb = null;
      }

      // go set error fields
      setupErrorFields(e);

      throw e;
    }
  }

  private void fixNullInputsForSOAP(CrownCounselIndexGetList_Properties fromClient) {
    // Transform "null" to null
    // Set hPubStartPoolName and hPubLinkKey to null if string < 1
    Class c = fromClient.getClass();
    java.beans.BeanInfo beanInfo = null;
    try {
      beanInfo = java.beans.Introspector.getBeanInfo(c);
    } catch (Exception e) {
    }
    java.beans.PropertyDescriptor[] properties = beanInfo.getPropertyDescriptors();
    for (int i = 0; i < properties.length; i++) {
      java.beans.PropertyDescriptor property = properties[i];
      java.lang.reflect.Method readMethod = property.getReadMethod();
      java.lang.reflect.Method writeMethod = property.getWriteMethod();
      if ((readMethod != null) && (writeMethod != null)) {
        String currentvalue = new String("");
        if (readMethod.getReturnType() == currentvalue.getClass()) {
          try {
            currentvalue = (String) readMethod.invoke(fromClient, null);
          } catch (Exception e1) {
          }
          if (currentvalue != null) {
            if (currentvalue.equals("null")) {
              try {
                Object[] args1 = new Object[1];
                args1[0] = null;
                writeMethod.invoke(fromClient, args1);
              } catch (Exception e2) {
              }
            }
            if ((currentvalue.length() < 1 || currentvalue.endsWith("/null"))
                && (writeMethod.getName().indexOf("PubStartPoolName") > -1)) {
              try {
                Object[] args1 = new Object[1];
                args1[0] = "ICONEJB/null";
                writeMethod.invoke(fromClient, args1);
              } catch (Exception e2) {
              }
            }
            if ((currentvalue.length() < 1) && (writeMethod.getName().indexOf("PubLinkKey") > -1)) {
              try {
                Object[] args1 = new Object[1];
                args1[0] = null;
                writeMethod.invoke(fromClient, args1);
              } catch (Exception e2) {
              }
            }
          }
        } else {
        }
      }
    }
  }

  private void fixNullOutputsForSOAP(CrownCounselIndexGetList_Properties fromClient) {
    // Transform null to "null"
    Class c = fromClient.getClass();
    java.beans.BeanInfo beanInfo = null;
    try {
      beanInfo = java.beans.Introspector.getBeanInfo(c);
    } catch (Exception e) {
    }
    java.beans.PropertyDescriptor[] properties = beanInfo.getPropertyDescriptors();
    for (int i = 0; i < properties.length; i++) {
      java.beans.PropertyDescriptor property = properties[i];
      java.lang.reflect.Method readMethod = property.getReadMethod();
      java.lang.reflect.Method writeMethod = property.getWriteMethod();
      if ((readMethod != null) && (writeMethod != null)) {
        String currentvalue = new String("");
        if (readMethod.getReturnType() == currentvalue.getClass()) {
          try {
            currentvalue = (String) (readMethod.invoke(fromClient, null));
          } catch (java.lang.reflect.InvocationTargetException a1) // Null argument
          {
            try {
              Object[] args1 = new Object[1];
              args1[0] = new String("null");
              writeMethod.invoke(fromClient, args1);
            } catch (Exception e2) {
            }
          } catch (Exception e1) {
          }
        } else {
        }
      }
    }
  }

  public CrownCounselIndexGetList_Properties processWSRequest(
      CrownCounselIndexGetList_Properties props) throws BeanException {

    if (tracing == true) {
      traceArgs[0] = this;
      traceArgs[1] =
          "CrownCounselIndexGetList_Access.processWSRequest(CrownCounselIndexGetList_Properties)";
      try {
        traceMethod.invoke(o, traceArgs);
      } catch (Exception x) {
      }
    }
    fixNullInputsForSOAP(props);

    inputProps = props;
    setHPubAccessHandleString(inputProps.getHPubAccessHandle());

    try {
      startHereCommon();
    } catch (BeanException e) {
      // remove the ejb instance if handle exists
      if (ejb != null) {
        try {
          ejb.remove();
        } catch (Exception x) {
        }
        ejb = null;
      }

      // go set error fields
      setupErrorFields(e);

      throw e;
    }
    outputProps.setHPubAccessHandle(getHPubAccessHandleString());
    fixNullOutputsForSOAP(outputProps);
    return outputProps;
  }

  private String getHPubAccessHandleString() {
    byte[] data = null;
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    ObjectOutputStream oos = null;
    try {
      oos = new ObjectOutputStream(baos);
      oos.writeObject(hPubAccessHandle);
      oos.flush();
      data = baos.toByteArray();
    } catch (IOException ioe) {
      System.out.println("Exception AccessEJBTemplate::getHPubAccessHandleString");
    }
    sun.misc.BASE64Encoder encoder = new sun.misc.BASE64Encoder();
    String encoded = encoder.encodeBuffer(data);
    return encoded;
  }

  private void setHPubAccessHandleString(String encodedHandleWithSpaces) {
    String encodedHandle = removeSpaceCharacters(encodedHandleWithSpaces);
    if ((encodedHandle == null) || (encodedHandle.length() < 5)) {
      return;
    }
    try {
      byte[] handleByteArray = null;
      sun.misc.BASE64Decoder dec = new sun.misc.BASE64Decoder();
      try {
        handleByteArray = dec.decodeBuffer(encodedHandle);
      } catch (Exception e) {
        System.out.println("AccessEJBTemplate::setHPubAccessHandleString()  decoding buffer");
      }
      ;
      ByteArrayInputStream bais = new ByteArrayInputStream(handleByteArray);
      javax.ejb.Handle h1 = null;
      try {
        ObjectInputStream ois = new ObjectInputStream(bais);
        hPubAccessHandle = (javax.ejb.Handle) ois.readObject();
      } catch (Exception ioe) {
        System.out.println("Exception reading handle object");
      }
    } catch (Exception e) {
      e.printStackTrace(System.err);
      System.out.println("Exception AccessEJBTemplate::setHPubAccessHandleString()");
    }
    return;
  }

  private String removeSpaceCharacters(String inputstr) {
    String outputstr = inputstr;
    int t = outputstr.indexOf(" ");
    while (t > -1) {
      outputstr = outputstr.substring(0, t) + outputstr.substring(t + 1);
      t = outputstr.indexOf(" ");
    }
    return outputstr;
  }
  /** event driven processing methods */
  public void hPubStartPerformed(HPubStartEvent evt) {
    if (tracing == true) {
      traceArgs[0] = this;
      traceArgs[1] = "CrownCounselIndexGetList_Access.hPubStartPerformed()";
      try {
        traceMethod.invoke(o, traceArgs);
      } catch (Exception x) {
      }
    }
    Thread newThread = new Thread(this);
    newThread.start();
  }

  public void run() {
    try {
      startHereCommon();
    } catch (BeanException e) {
      // remove the ejb instance if handle exists
      if (ejb != null) {
        try {
          ejb.remove();
        } catch (Exception x) {
        }
        ejb = null;
      }

      // go set error fields
      setupErrorFields(e);
    }
  }

  public void addHPubReqCompleteListener(HPubReqCompleteListener listenerToAdd) {
    listenerList.addElement(listenerToAdd);
  }

  public void removeHPubReqCompleteListener(HPubReqCompleteListener listenerToRemove) {
    listenerList.removeElement(listenerToRemove);
  }

  protected void fireHPubReqCompleteEvent(RequestCompleteEvent evt) {
    Vector currentListenerList = null;

    synchronized (this) {
      currentListenerList = (Vector) listenerList.clone();
    }
    for (int i = 0; i < currentListenerList.size(); i++) {
      HPubReqCompleteListener listener = (HPubReqCompleteListener) currentListenerList.elementAt(i);
      listener.hPubReqComplete(evt);
    }
  }

  /** all processing methods end up here */
  private void startHereCommon() throws BeanException {
    // try to get the linkKey if already set in input properties
    try {
      hPubLinkKey = inputProps.getHPubLinkKey();
    } catch (Exception e) {
    }

    // if running in Web environment and either the ejb access handle or
    // the linkKey are null, try to get them from the HttpSession
    if (oHttpServletRequest != null) {
      HttpSession theWebsession = oHttpServletRequest.getSession(false);
      if (theWebsession != null) {
        synchronized (theWebsession) {
          try {
            if (tracing == true) {
              traceArgs[0] = this;
              traceArgs[1] = "HttpSession.getId()=" + theWebsession.getId();
              try {
                traceMethod.invoke(o, traceArgs);
              } catch (Exception x) {
              }
            }
            String theKey = KEY_WEBCONN + inputProps.getHPubStartChainName();
            // if linkKey or access handle is null try to get it from Websession
            HPubEJB2HttpSessionBindingListener sbl =
                (HPubEJB2HttpSessionBindingListener) theWebsession.getAttribute(theKey);
            if ((hPubLinkKey == null) && (sbl != null)) {
              hPubLinkKey = sbl.getLinkKey();
              if (tracing == true) {
                traceArgs[0] = this;
                traceArgs[1] = "HttpSession.getAttribute(hPubLinkKey)=" + hPubLinkKey;
                try {
                  traceMethod.invoke(o, traceArgs);
                } catch (Exception x) {
                }
              }
              inputProps.setHPubLinkKey(hPubLinkKey);
            }
            if ((hPubAccessHandle == null) && (sbl != null)) {
              hPubAccessHandle = sbl.getEjbHandle();
              if (tracing == true) {
                traceArgs[0] = this;
                traceArgs[1] = "HttpSession.getAttribute(hPubAccessHandle)=" + hPubAccessHandle;
                try {
                  traceMethod.invoke(o, traceArgs);
                } catch (Exception x) {
                }
              }
            }
            // set the ejb handle to null before removing the Session Binding
            // Listener object
            if (auditing == true) {
              if (sbl != null)
                auditArgs[0] =
                    "\n---\nOUT:"
                        + this.getClass().getName()
                        + " "
                        + theKey
                        + " "
                        + hPubAccessHandle
                        + " "
                        + hPubLinkKey
                        + " "
                        + theWebsession.getId();
              else // error - object not found in HttpSession
              auditArgs[0] =
                    "\n---\nERR:"
                        + this.getClass().getName()
                        + " "
                        + theKey
                        + " "
                        + theWebsession.getId();

              auditArgs[1] = theWebsession;
              try {
                auditMethod.invoke(o, auditArgs);
              } catch (Exception x) {
              }
            }
            if (sbl != null) sbl.setEjbHandle(null);
            theWebsession.removeAttribute(theKey);
          } catch (IllegalStateException e) {
          }
        }
      }
    }
    // if either of required properties are still null then the ejb cannot
    // be accessed - throw an exception.
    if ((hPubAccessHandle == null) || (hPubLinkKey == null)) {
      String errMsg =
          (new Date(System.currentTimeMillis())).toString()
              + " HPS5951 "
              + this.getClass().getName()
              + ": hPubAccessHandle==null || hPubLinkKey==null";
      System.err.println(errMsg);
      if (tracing == true) {
        traceArgs[0] = this;
        traceArgs[1] = errMsg;
        try {
          traceMethod.invoke(o, traceArgs);
        } catch (Exception x) {
        }
      }
      throw new BeanException(errMsg);
    } else {
      if (tracing == true) {
        traceArgs[0] = this;
        traceArgs[1] = "hPubAccessHandle=" + hPubAccessHandle + ",hPubLinkKey=" + hPubLinkKey;
        try {
          traceMethod.invoke(o, traceArgs);
        } catch (Exception x) {
        }
      }
    }

    // get the EJB object from the handle
    try {
      ejb =
          (com.ibm.HostPublisher.EJB.HPubEJB2)
              javax.rmi.PortableRemoteObject.narrow(
                  hPubAccessHandle.getEJBObject(), com.ibm.HostPublisher.EJB.HPubEJB2.class);
    } catch (Exception e) {
      String errMsg =
          (new Date(System.currentTimeMillis())).toString()
              + " HPS5952 "
              + this.getClass().getName()
              + ": getEJBObject(): "
              + e.getClass().getName()
              + ": "
              + e.getMessage();
      System.err.println(errMsg);
      if (tracing == true) {
        traceArgs[0] = this;
        traceArgs[1] = errMsg;
        try {
          traceMethod.invoke(o, traceArgs);
        } catch (Exception x) {
        }
      }
      throw new BeanException(errMsg);
    }
    // if ejb handle, go invoke the HPubEJB's main business method.
    if (ejb != null) {
      try {
        outputProps = (CrownCounselIndexGetList_Properties) ejb.processIO(inputProps);
        inputProps = outputProps;
        inputProps.setInitialCall(false);
      } catch (Exception e) {
        String errMsg =
            (new Date(System.currentTimeMillis())).toString()
                + " HPS5953 "
                + this.getClass().getName()
                + ": processIO("
                + inputProps.getClass().getName()
                + "): "
                + e.getClass().getName()
                + ": "
                + e.getMessage();
        System.err.println(errMsg);
        if (tracing == true) {
          traceArgs[0] = this;
          traceArgs[1] = errMsg;
          try {
            traceMethod.invoke(o, traceArgs);
          } catch (Exception x) {
          }
        }
        throw new BeanException(errMsg);
      }
    }
    endHereCommon();
    return;
  }

  private void endHereCommon() throws BeanException {
    // save EJB object handle in property
    if (ejb != null) {
      try {
        hPubAccessHandle = ejb.getHandle();
      } catch (Exception e) {
        String errMsg =
            (new Date(System.currentTimeMillis())).toString()
                + " HPS5955 "
                + this.getClass().getName()
                + ": ejb.getHandle(), ejb="
                + ejb
                + ": "
                + e.getClass().getName()
                + ": "
                + e.getMessage();
        System.err.println(errMsg);
        if (tracing == true) {
          traceArgs[0] = this;
          traceArgs[1] = errMsg;
          try {
            traceMethod.invoke(o, traceArgs);
          } catch (Exception x) {
          }
        }
        throw new BeanException(errMsg);
      }
    }
    // save ejb accessHandle and hpubLinkKey in HttpSession
    if ((oHttpServletRequest != null) && (outputProps != null)) {
      // a new HPubEjb2HttpSessionBindingListener object containing the ejb access
      // handle and hPubLinkKey for the connection is bound to the session using
      // a prefix and the ending connection state of the IO just processed.
      // This hPubLinkKey uniquely identifies the connection associated with the
      // IO chain for that HP Runtime JVM.
      // The ejb access handle is contained within the HPubEjb2HttpSessionBindingListener
      // object so that an ejb remove can be issued in the case where a session
      // timeout or session invalidation occurs for an incomplete IO chain.
      HttpSession theWebsession = oHttpServletRequest.getSession(true);
      if (theWebsession != null) {
        synchronized (theWebsession) {
          try {
            String theKey = KEY_WEBCONN + outputProps.getHPubEndChainName();
            hPubLinkKey = outputProps.getHPubLinkKey();
            theWebsession.setAttribute(
                theKey, new HPubEJB2HttpSessionBindingListener(hPubAccessHandle, hPubLinkKey));
            if (tracing == true) {
              traceArgs[0] = this;
              traceArgs[1] =
                  "theWebsession.setAttribute("
                      + theKey
                      + ",new HPubEJB2HttpSessionBindingListener("
                      + hPubAccessHandle
                      + ", "
                      + hPubLinkKey
                      + "))";
              try {
                traceMethod.invoke(o, traceArgs);
              } catch (Exception x) {
              }
            }
            if (auditing == true) {
              auditArgs[0] =
                  "\n---\nIN:"
                      + this.getClass().getName()
                      + " "
                      + theKey
                      + " "
                      + hPubAccessHandle
                      + " "
                      + hPubLinkKey
                      + " "
                      + theWebsession.getId();
              auditArgs[1] = theWebsession;
              try {
                auditMethod.invoke(o, auditArgs);
              } catch (Exception x) {
              }
            }
          } catch (Exception e) {
            hPubLinkKey = null; // set to null to force following error logic
          }
        }
      }
      // if an error occurred throw an exception to cause ejb remove to be issued.
      if ((theWebsession == null) || (hPubLinkKey == null)) {
        String errMsg =
            (new Date(System.currentTimeMillis())).toString()
                + " HPS5956 "
                + this.getClass().getName()
                + ": HttpServletRequest.getSession(true), hPubLinkKey="
                + hPubLinkKey;
        System.err.println(errMsg);
        if (tracing == true) {
          traceArgs[0] = this;
          traceArgs[1] = errMsg;
          try {
            traceMethod.invoke(o, traceArgs);
          } catch (Exception x) {
          }
        }
        throw new BeanException(errMsg);
      }
    }
    // send Event to User indicating that the Query request is complete
    RequestCompleteEvent hPubEvent = new RequestCompleteEvent(this);
    fireHPubReqCompleteEvent(hPubEvent);
    return;
  }

  protected void setupErrorFields(Exception oException) {
    // if hPubErrorOccurred not set by actual driving of Integration
    // Object, then set error fields in output Properties object
    // if it exists, otherwise set them in input Properties object.
    if (this.getHPubErrorOccurred() == 0) {
      if (outputProps != null) {
        outputProps.setHPubErrorOccurred(1);
        outputProps.setHPubErrorException(oException);
        if (oException.getMessage() != null)
          outputProps.setHPubErrorMessage(oException.getMessage());
      } else {
        inputProps.setHPubErrorOccurred(1);
        inputProps.setHPubErrorException(oException);
        if (oException.getMessage() != null)
          inputProps.setHPubErrorMessage(oException.getMessage());
      }
    }
  }
}
Example #25
0
 boolean isMac() {
   String osname = System.getProperty("os.name");
   return osname.startsWith("Mac");
 }
 public static int appleOSVersion() {
   if (!appleEawtAvailable()) return -1;
   return Integer.parseInt(System.getProperty("os.version").split("[.]")[1]);
 }
 public static boolean appleEawtAvailable() {
   return System.getProperty("os.name").contains("OS X");
 }
 public static int javaVersion() {
   return Integer.parseInt(System.getProperty("java.specification.version").split("[.]")[1]);
 }
Example #29
0
  private static void initialize() {
    props = new Properties();
    boolean loadedProps = false;
    boolean overrideAll = false;

    // first load the system properties file
    // to determine the value of security.overridePropertiesFile
    File propFile = securityPropFile("java.security");
    if (propFile.exists()) {
      try {
        FileInputStream fis = new FileInputStream(propFile);
        InputStream is = new BufferedInputStream(fis);
        props.load(is);
        is.close();
        loadedProps = true;

        if (sdebug != null) {
          sdebug.println("reading security properties file: " + propFile);
        }
      } catch (IOException e) {
        if (sdebug != null) {
          sdebug.println("unable to load security properties from " + propFile);
          e.printStackTrace();
        }
      }
    }

    if ("true".equalsIgnoreCase(props.getProperty("security.overridePropertiesFile"))) {

      String extraPropFile = System.getProperty("java.security.properties");
      if (extraPropFile != null && extraPropFile.startsWith("=")) {
        overrideAll = true;
        extraPropFile = extraPropFile.substring(1);
      }

      if (overrideAll) {
        props = new Properties();
        if (sdebug != null) {
          sdebug.println("overriding other security properties files!");
        }
      }

      // now load the user-specified file so its values
      // will win if they conflict with the earlier values
      if (extraPropFile != null) {
        try {
          URL propURL;

          extraPropFile = PropertyExpander.expand(extraPropFile);
          propFile = new File(extraPropFile);
          if (propFile.exists()) {
            propURL = new URL("file:" + propFile.getCanonicalPath());
          } else {
            propURL = new URL(extraPropFile);
          }
          BufferedInputStream bis = new BufferedInputStream(propURL.openStream());
          props.load(bis);
          bis.close();
          loadedProps = true;

          if (sdebug != null) {
            sdebug.println("reading security properties file: " + propURL);
            if (overrideAll) {
              sdebug.println("overriding other security properties files!");
            }
          }
        } catch (Exception e) {
          if (sdebug != null) {
            sdebug.println("unable to load security properties from " + extraPropFile);
            e.printStackTrace();
          }
        }
      }
    }

    if (!loadedProps) {
      initializeStatic();
      if (sdebug != null) {
        sdebug.println("unable to load security properties " + "-- using defaults");
      }
    }
  }
Example #30
0
public class StructDef 
    extends TypedefDef
    implements org.omg.CORBA.StructDefOperations, ContainerType
{
    protected static char 	    fileSeparator = 
        System.getProperty("file.separator").charAt(0);

    private org.omg.CORBA.TypeCode       type;
    private Class                        myClass;
    private Class                        helperClass;
    private org.omg.CORBA.StructMember[] members;

    /** local references to contained objects */
    private Hashtable		             containedLocals = new Hashtable();
    /** CORBA references to contained objects */
    private java.util.Hashtable	         contained = new java.util.Hashtable();

    private File 		         my_dir;
    private String                       path;

    private boolean defined = false;

    public StructDef(Class c, 
                     String path,
                     org.omg.CORBA.Container _defined_in,
                     org.omg.CORBA.Repository ir)
    {
        def_kind = org.omg.CORBA.DefinitionKind.dk_Struct;
        containing_repository = ir;
        defined_in = _defined_in;
        this.path = path;
        Debug.assert( defined_in != null, "defined_in = null");
        Debug.assert( containing_repository != null, "containing_repository = null");

        try
        { 
            String classId = c.getName();
            myClass = c;
            version( "1.0" );
            full_name = classId.replace('.', '/');

            if( classId.indexOf('.') > 0 ) 
            {
                name( classId.substring( classId.lastIndexOf('.')+1 ) );
                absolute_name = 
                    org.omg.CORBA.ContainedHelper.narrow( defined_in ).absolute_name() + 
                    "::" + name;
            }             
            else 
            {
                name( classId );
                absolute_name = "::" + name;
            }
	
            helperClass = RepositoryImpl.loader.loadClass( classId + "Helper") ;
            id( (String)helperClass.getDeclaredMethod( "id", null ).invoke( null, null ));
            type = 
                TypeCodeUtil.getTypeCode( myClass, RepositoryImpl.loader, null, classId );
            
            members = new org.omg.CORBA.StructMember[ type.member_count() ];
            for( int i = 0; i < members.length; i++ )
            {
                org.omg.CORBA.TypeCode type_code = type.member_type(i);
                String member_name = type.member_name(i);
                members[i] = new org.omg.CORBA.StructMember( member_name, 
                                                             type_code,
                                                             null );
            }
            /* get directory for nested definitions' classes */
            File f = new File( path + fileSeparator + 
                               classId.replace('.', fileSeparator) + "Package" );

            if( f.exists() && f.isDirectory() )
                my_dir = f;
            org.jacorb.util.Debug.output(2, "StructDef: " + absolute_name );
        }
        catch ( Exception e )
        {
            e.printStackTrace();
            throw new org.omg.CORBA.INTF_REPOS( ErrorMsg.IR_Not_Implemented,
                                                org.omg.CORBA.CompletionStatus.COMPLETED_NO);
        }
    }


    public void loadContents()
    {
        // read from the  class (operations and atributes)
        Debug.assert( getReference() != null, "my own ref null");

        org.omg.CORBA.StructDef myReference = 
            org.omg.CORBA.StructDefHelper.narrow( getReference());

        Debug.assert( myReference != null, "narrow failed for " + getReference() );

        /* load nested definitions from interfacePackage directory */
        
        String[] classes = null;
        if( my_dir != null )
        {
            classes = my_dir.list( new IRFilenameFilter(".class") );

            // load class files in this interface's Package directory
            if( classes != null) 
            {
                for( int j = 0; j < classes.length; j++ )
                {
                    try 
                    { 
                        org.jacorb.util.Debug.output(2, "Struct " +name+ " tries " + 
                                                 full_name.replace('.', fileSeparator) + 
                                                 "Package" + fileSeparator + 
                                                 classes[j].substring( 0, classes[j].indexOf(".class")) );

                        ClassLoader loader = getClass().getClassLoader();
                        if( loader == null )
                        {
                            loader = RepositoryImpl.loader;
                        }

                        Class cl = 
                            loader.loadClass( 
                                             ( full_name.replace('.', fileSeparator) + "Package" + fileSeparator + 
                                               classes[j].substring( 0, classes[j].indexOf(".class"))
                                               ).replace( fileSeparator, '/') );
                        

                        Contained containedObject = Contained.createContained( cl, 
                                                                               path,
                                                                               myReference, 
                                                                               containing_repository );
                        if( containedObject == null )
                            continue;
                        
                        org.omg.CORBA.Contained containedRef = 
                            Contained.createContainedReference(containedObject);
                        
                        if( containedObject instanceof ContainerType )
                            ((ContainerType)containedObject).loadContents();
                        
                        containedRef.move( myReference, containedRef.name(), containedRef.version() );
                        
                        org.jacorb.util.Debug.output(2, "Struct " + full_name + 
                                                 " loads "+ containedRef.name() );
                        contained.put( containedRef.name() , containedRef );
                        containedLocals.put( containedRef.name(), containedObject );                        
                    } 
                    catch ( Exception e ) 
                    {
                        e.printStackTrace();
                    }
                }
            }
        }
    }


    /**
     */

    public void define()
    {
        org.jacorb.util.Debug.output(2, "Struct " + name +  " defining...");
        for( Enumeration e = containedLocals.elements();
             e.hasMoreElements();
             ((IRObject)e.nextElement()).define())
            ;

        for( int i = 0; i < members.length; i++ )
        {
            members[i].type_def = IDLType.create( members[i].type, containing_repository);
            org.jacorb.util.Debug.assert( members[i].type_def != null,
                                      "No type_def for member " + members[i].name + 
                                      " in struct " +  full_name );
        }
        defined = true;
        org.jacorb.util.Debug.output(2, "Struct " + name +  " defined");

    }

    /**
     */

    org.omg.CORBA.TypeDescription describe_struct() 
    {
        org.jacorb.util.Debug.assert( defined,
                                  "Struct " + full_name + " not defined! ");
        return new org.omg.CORBA.TypeDescription(name(), 
                                                 id(), 
                                                 org.omg.CORBA.ContainedHelper.narrow( defined_in ).id(),
                                                 version(), 
                                                 type());
    }

    public org.omg.CORBA.TypeCode type() 
    {
        Debug.assert( type != null, "Struct TypeCode is null");
        return type;
    }

    public org.omg.CORBA.Contained lookup( String scopedname )
    {
        org.jacorb.util.Debug.output(2,"Struct " + this.name + " lookup " + scopedname );

        String top_level_name;
        String rest_of_name;
        String name;

        if( scopedname.startsWith("::") )       
        {
            name = scopedname.substring(2);
        }
        else
            name = scopedname;

        if( name.indexOf("::") > 0 )
        {
            top_level_name = name.substring( 0, name.indexOf("::") );
            rest_of_name = name.substring( name.indexOf("::") + 2);
        } 
        else 
        {
            top_level_name = name;
            rest_of_name = null;
        }
		
        try
        {
            org.omg.CORBA.Contained top = 
                (org.omg.CORBA.Contained)contained.get( top_level_name );

            if( top == null )
            {
                org.jacorb.util.Debug.output(2,"Interface " + this.name + 
                                         " top " + top_level_name + " not found ");
                return null;
            }
	
            if( rest_of_name == null )
            {
                return top;
            }
            else 
            {
                if( top instanceof org.omg.CORBA.Container)
                {
                    return ((org.omg.CORBA.Container)top).lookup( rest_of_name );
                }
                else
                {
                    org.jacorb.util.Debug.output(2,"Interface " + this.name +
                                             " " + scopedname + " not found ");
                    return null;		
                }
            }
        } 
        catch( Exception e )
        {
            e.printStackTrace();
            return null;			
        }	
    }

    public org.omg.CORBA.StructMember[] members()
    {
        org.jacorb.util.Debug.assert( defined,
                                  "Struct " + full_name + " not defined! ");
        return members;
    }

 
    // write interface not supported!

    public void members(org.omg.CORBA.StructMember[] a)
    {
    }


    public org.omg.CORBA.ModuleDef create_module( String id, String name, String version)
    {
        return null;
    }

    public org.omg.CORBA.ConstantDef create_constant(java.lang.String id, 
                                                     java.lang.String name, 
                                                     java.lang.String version, 
                                                     org.omg.CORBA.IDLType type, 
                                                     org.omg.CORBA.Any value)
    {
        return null;
    }

    public org.omg.CORBA.StructDef create_struct( String id, String name, 
                                                  String version,
                                                  org.omg.CORBA.StructMember[] members){
        return null;
    }

    public org.omg.CORBA.UnionDef create_union( String id, String name, 
                                                String version, 
                                                org.omg.CORBA.IDLType discriminator_type, 
                                                org.omg.CORBA.UnionMember[] members){
        return null;
    }

    public org.omg.CORBA.EnumDef create_enum( String id, String name, 
                                              String version,  String[] members){
        return null;
    }

    public org.omg.CORBA.AliasDef create_alias( String id, String name, 
                                                String version, 
                                                org.omg.CORBA.IDLType original_type){
        return null;
    }

    /**
     * not supported
     */

    public org.omg.CORBA.ExceptionDef create_exception(java.lang.String id, 
                                                       java.lang.String name , 
                                                       java.lang.String version, 
                                                       org.omg.CORBA.StructMember[] member ) 
    {
        return null;
    }

    /**
     * not supported
     */

    public org.omg.CORBA.InterfaceDef create_interface(
                                                       String id, 
                                                       String name,
                                                       String version, 
                                                       org.omg.CORBA.InterfaceDef[] base_interfaces,
                                                       boolean is_abstract )
    {
        return null;
    }

    /**
     * not supported
     */

    public org.omg.CORBA.ValueBoxDef create_value_box(java.lang.String id, 
                                                      java.lang.String name, 
                                                      java.lang.String version, 
                                                      org.omg.CORBA.IDLType type)
    {
        return null;
    }


    /**
     * not supported
     */

    public  org.omg.CORBA.ValueDef create_value(
                                                java.lang.String id, 
                                                java.lang.String name, 
                                                java.lang.String version,
                                                boolean is_custom, 
                                                boolean is_abstract, 
                                                org.omg.CORBA.ValueDef base_value, 
                                                boolean is_truncatable, 
                                                org.omg.CORBA.ValueDef[] abstract_base_values, 
                                                org.omg.CORBA.InterfaceDef[] supported_interfaces, 
                                                org.omg.CORBA.Initializer[] initializers)
    {
        return null;
    }


    /**
     * not supported
     */

    public org.omg.CORBA.NativeDef create_native(java.lang.String id, 
                                                 java.lang.String name, 
                                                 java.lang.String version)
    {
        return null;
    }
 



    public void destroy()
    {
        throw new org.omg.CORBA.INTF_REPOS(ErrorMsg.IR_Not_Implemented,
                                           org.omg.CORBA.CompletionStatus.COMPLETED_NO);
    }


    public org.omg.CORBA.Contained[] lookup_name( String search_name, 
                                                  int levels_to_search, 
                                                  org.omg.CORBA.DefinitionKind limit_type, 
                                                  boolean exclude_inherited )
    {
        if( levels_to_search == 0 )
            return null;

        org.omg.CORBA.Contained[] c = contents( limit_type, exclude_inherited );
        Hashtable found = new Hashtable();

        for( int i = 0; i < c.length; i++)
            if( c[i].name().equals( search_name ) )
                found.put( c[i], "" );

        if( levels_to_search > 1 || levels_to_search == -1 )
        {
            // search up to a specific depth or undefinitely
            for( int i = 0; i < c.length; i++)
            {
                if( c[i] instanceof org.omg.CORBA.Container )
                {
                    org.omg.CORBA.Contained[] tmp_seq = 
                        ((org.omg.CORBA.Container)c[i]).lookup_name( search_name, 
                                                                     levels_to_search-1, 
                                                                     limit_type, 
                                                                     exclude_inherited);
                    if( tmp_seq != null )
                        for( int j = 0; j < tmp_seq.length; j++)
                            found.put( tmp_seq[j], "" );
                }
            } 			
        }

		
        org.omg.CORBA.Contained[] result = new org.omg.CORBA.Contained[ found.size() ];
        int idx = 0;

        for( Enumeration e = found.keys(); e.hasMoreElements(); )
            result[ idx++] = (org.omg.CORBA.Contained)e.nextElement();

        return result;
    }

    public org.omg.CORBA.ContainerPackage.Description[] describe_contents( 
                                                     org.omg.CORBA.DefinitionKind limit_type, 
                                                     boolean exclude_inherited, 
                                                     int max_returned_objs )
    {
        return null;
    }


    public org.omg.CORBA.Contained[] contents(org.omg.CORBA.DefinitionKind limit_type, 
                                              boolean exclude_inherited)
    {
        Hashtable limited = new Hashtable();

        // analog constants, exceptions etc.

        for( Enumeration e = contained.elements(); e.hasMoreElements();  )
        {
            org.omg.CORBA.Contained c = (org.omg.CORBA.Contained)e.nextElement();
            if( limit_type == org.omg.CORBA.DefinitionKind.dk_all || 
                limit_type == c.def_kind() )
            {
                limited.put( c, "" );
            }
        }

        org.omg.CORBA.Contained[] c = new org.omg.CORBA.Contained[limited.size()];
        int i;
        Enumeration e;
        for( e = limited.keys(), i=0 ; e.hasMoreElements(); i++ )
            c[i] = (org.omg.CORBA.Contained)e.nextElement();
        return c;			
    }


    // from Contained

    public org.omg.CORBA.ContainedPackage.Description describe()
    {
        org.jacorb.util.Debug.assert( defined,
                                  "Struct " + full_name + "not defined! ");

        org.omg.CORBA.Any a = orb.create_any();
        org.omg.CORBA.TypeDescription ed = describe_struct();
        org.omg.CORBA.TypeDescriptionHelper.insert( a, ed );
        return new org.omg.CORBA.ContainedPackage.Description( 
                                                              org.omg.CORBA.DefinitionKind.dk_Struct, a);
    }

}