| 72 | }; |
| 73 | |
| 74 | bool java_class_gen(const JavaName &jn, JavaFileType jft, const char *body, |
| 75 | const char *extends = "", |
| 76 | const char *implements = "") |
| 77 | { |
| 78 | string file, pkgdecl; |
| 79 | |
| 80 | for_each(jn.pkg_.begin(), jn.pkg_.end(), concat(file, '/')); |
| 81 | for_each(jn.pkg_.begin(), jn.pkg_.end(), concat(pkgdecl, '.')); |
| 82 | |
| 83 | //remove trailing dot |
| 84 | if (jn.pkg_.size() > 0) pkgdecl.resize(pkgdecl.size() - 1); |
| 85 | |
| 86 | //create directories |
| 87 | string path; |
| 88 | |
| 89 | for (size_t i = 0; i < jn.pkg_.size(); ++i) { |
| 90 | path += jn.pkg_[i] + '/'; |
| 91 | |
| 92 | if (0 != ACE_OS::mkdir(path.c_str()) && errno != EEXIST) { |
| 93 | cerr << "ERROR - couldn't create directory " << path << "\n"; |
| 94 | return false; |
| 95 | } |
| 96 | } |
| 97 | |
| 98 | file += jn.clazz_; |
| 99 | file += ".java"; |
| 100 | |
| 101 | string classkeyw; |
| 102 | |
| 103 | switch (jft) { |
| 104 | case JCLASS: |
| 105 | classkeyw = "class"; |
| 106 | break; |
| 107 | case JINTERFACE: |
| 108 | classkeyw = "interface"; |
| 109 | break; |
| 110 | case JABSTRACT_CLASS: |
| 111 | classkeyw = "abstract class"; |
| 112 | break; |
| 113 | case JFINAL_CLASS: |
| 114 | classkeyw = "final class"; |
| 115 | break; |
| 116 | } |
| 117 | |
| 118 | string nlib = be_global->native_lib_name().c_str(); |
| 119 | string nativeLoader; |
| 120 | |
| 121 | if (nlib != "" && ACE_OS::strstr(body, " native ")) { |
| 122 | nativeLoader = "\n" |
| 123 | " static {\n" |
| 124 | " String propVal = System.getProperty(\"opendds.native.debug\");\n" |
| 125 | " if (propVal != null && (\"1\".equalsIgnoreCase(propVal) ||\n" |
| 126 | " \"y\".equalsIgnoreCase(propVal) ||\n" |
| 127 | " \"yes\".equalsIgnoreCase(propVal) ||\n" |
| 128 | " \"t\".equalsIgnoreCase(propVal) ||\n" |
| 129 | " \"true\".equalsIgnoreCase(propVal)))\n" |
| 130 | " System.loadLibrary(\"" + nlib + "d\");\n" |
| 131 | " else System.loadLibrary(\"" + nlib + "\");\n" |
no test coverage detected