1 23 package org.enhydra.kelp.common.node; 24 25 import org.enhydra.tool.ToolBoxInfo; 27 import org.enhydra.tool.archive.Descriptor; 28 import org.enhydra.tool.archive.JarPlan; 29 import org.enhydra.tool.archive.WarPlan; 30 import org.enhydra.tool.archive.ArchiveException; 31 import org.enhydra.tool.archive.PropertyReader; 32 import org.enhydra.tool.archive.PropertyWriter; 33 import org.enhydra.tool.common.PathHandle; 34 import org.enhydra.tool.common.ToolException; 35 import org.enhydra.tool.configure.ConfigTool; 36 37 import org.enhydra.kelp.KelpInfo; 39 import org.enhydra.kelp.common.Constants; 40 import org.enhydra.kelp.common.Backward; 41 import org.enhydra.kelp.common.PathUtil; 42 import org.enhydra.kelp.common.PropUtil; 43 import org.enhydra.kelp.common.map.MapEntry; 44 import org.enhydra.kelp.common.map.MapUtil; 45 46 import java.io.BufferedInputStream ; 48 import java.io.BufferedOutputStream ; 49 import java.io.File ; 50 import java.io.FileInputStream ; 51 import java.io.FileNotFoundException ; 52 import java.io.FileOutputStream ; 53 import java.io.IOException ; 54 import java.util.Vector ; 55 import java.util.ArrayList ; 56 import java.util.Arrays ; 57 import java.util.Properties ; 58 import org.enhydra.dods.generator.DODSGenerator; 59 60 61 abstract public class OtterProject implements OtterNode { 63 public final static int MAP_SCOPE_ALL = 0; 64 public final static int MAP_SCOPE_SELECTED = 1; 65 public final static int MAP_SCOPE_NONE = 2; 66 67 public final static int TYPE_UNKNOWN = -1; 69 public final static int TYPE_WEBAPP = 0; 72 public final static int TYPE_EN3APP = 1; 75 76 private DODSGenerator generator = null; 77 private boolean documentationHtml; 78 private boolean documentationPdf; 79 private boolean documentationXmi; 80 private boolean documentationPtl; 81 82 abstract public String getCodeGenDefaultDestination(); 84 85 88 abstract public OtterTextFileNode getFirstPolicy(); 89 90 93 abstract public String getWorkingPath(); 94 95 98 abstract public void setWorkingPath(String path); 99 100 103 abstract public OtterTextFileNode[] getAllDeploymentDescs(); 104 105 111 abstract public OtterFileNode[] findFileNodesByType(String [] extensions); 112 113 116 abstract public OtterFileNode[] getAllInput(); 117 118 121 abstract public OtterDocumentNode[] getAllDocuments(); 122 123 126 abstract public Object getNativeProject(); 127 abstract public String getRootPath(); 128 129 132 abstract public boolean isOpenBuild(); 133 134 139 abstract public String getClassOutputPath(); 140 abstract public void setClassOutputPath(String p); 141 142 abstract public boolean isDefaultProject(); 144 145 150 abstract public String getSourcePath(); 151 152 157 abstract public String [] getSourcePathArray(); 158 159 164 abstract public void setSourcePathArray(String [] pathAsArray); 165 166 172 abstract public String getClassPath(); 173 174 181 abstract public String getProperty(String property); 182 183 188 abstract public OtterNodeFactory getNodeFactory(); 189 190 194 abstract public void configureRunClass(); 195 196 202 abstract public void setProperty(String property, String value); 203 204 210 abstract public void setProperty(String property, int value); 211 212 public String getProjectRootName() { 215 File root = new File (getRootPath()); 216 String projectName = root.getName(); 217 218 return projectName; 219 } 220 221 public String [] getDocTypes() { 222 String [] exts = new String [0]; 223 String extList = null; 224 225 exts = ToolBoxInfo.getSupportedDocTypes(); extList = getProperty(XMLC_DOC_TYPES); 227 exts = PropUtil.listToArray(extList, exts); 228 return exts; 229 } 230 231 public void setDocTypes(String [] exts) { 232 String extList = null; 233 234 extList = PropUtil.arrayToList(exts); 235 setProperty(XMLC_DOC_TYPES, extList); 236 } 237 238 public String [] getNonDocumentContentTypes() { 239 String [] exts = PropertyKeys.DEFAULT_CONTENT; 240 String extTypes = null; 241 242 extTypes = getProperty(DEPLOY_CONTENT_TYPES); 243 exts = PropUtil.listToArray(extTypes, exts); 244 return exts; 245 } 246 247 public String [] getContentTypes() { 248 ArrayList list = null; 249 String [] docs = new String [0]; 250 String [] exts = getNonDocumentContentTypes(); 251 252 list = new ArrayList (Arrays.asList(exts)); 254 docs = getDocTypes(); 255 for (int i = 0; i < docs.length; i++) { 256 if (!list.contains(docs[i])) { 257 list.add(docs[i]); 258 } 259 } 260 266 list.trimToSize(); 267 exts = new String [list.size()]; 268 exts = (String []) list.toArray(exts); 269 return exts; 270 } 271 272 public void setContentTypes(String [] exts) { 273 ArrayList list = null; 274 String [] docs = new String [0]; 275 String extTypes = null; 276 277 list = new ArrayList (Arrays.asList(exts)); 279 docs = getDocTypes(); 280 for (int i = 0; i < docs.length; i++) { 281 if (list.contains(docs[i])) { 282 list.remove(docs[i]); 283 } 284 } 285 list.trimToSize(); 286 exts = new String [list.size()]; 287 exts = (String []) list.toArray(exts); 288 extTypes = PropUtil.arrayToList(exts); 289 setProperty(DEPLOY_CONTENT_TYPES, extTypes); 290 } 291 292 298 public OtterXMLCNode[] getAllXMLCNodes() { 299 OtterDocumentNode[] docNodes = new OtterDocumentNode[0]; 300 OtterXMLCNode[] xmlcNodes = new OtterXMLCNode[0]; 301 302 docNodes = getAllDocuments(); 303 xmlcNodes = new OtterXMLCNode[docNodes.length]; 304 for (int i = 0; i < docNodes.length; i++) { 305 xmlcNodes[i] = new OtterXMLCNode(docNodes[i]); 306 } 307 return xmlcNodes; 308 } 309 310 315 public String getXMLCOptionFilePath() { 316 String filename = new String (); 317 File file = PathUtil.getFileRelativeToProject(this, 318 PropertyKeys.NAME_XMLC_OPTION_FILEPATH); 319 320 if ((file != null) && file.exists() && (!file.isDirectory())) { 321 filename = file.getAbsolutePath(); 322 } 323 return filename; 324 } 325 326 331 public void setXMLCOptionFilePath(String filename) { 332 PathUtil.putFileRelativeToProject(this, 333 PropertyKeys.NAME_XMLC_OPTION_FILEPATH, 334 filename); 335 } 336 337 343 public String getXMLCParameters() { 344 String params = getProperty(PropertyKeys.NAME_XMLC_PARAMETERS); 345 346 params = PropUtil.removeQuotes(params); 347 return params; 348 } 349 350 355 public void setXMLCParameters(String p) { 356 setProperty(PropertyKeys.NAME_XMLC_PARAMETERS, p); 357 } 358 359 365 public boolean isPrintDOM() { 366 return readBooleanProperty(XMLC_PRINT_DOM, false); 367 } 368 369 374 public void setPrintDOM(boolean b) { 375 writeBooleanProperty(XMLC_PRINT_DOM, b); 376 } 377 378 383 public boolean isXMLCBuild() { 384 return readBooleanProperty(XMLC_BUILD, false); 385 } 386 387 392 public boolean isDodsBuild() { 393 return readBooleanProperty(DODS_BUILD, false); 394 } 395 396 402 public void setXMLCBuild(boolean b) { 403 writeBooleanProperty(XMLC_BUILD, b); 404 } 405 406 411 public int getDeployType() { 412 String in = getProperty(DEPLOY_TYPE); 413 int type = TYPE_UNKNOWN; 414 415 type = PropUtil.stringToInt(in, TYPE_UNKNOWN); 416 if (type == TYPE_UNKNOWN) { 417 if (Backward.createIsWebApp(getSourcePathArray())) { 418 type = TYPE_WEBAPP; 419 } 420 } 421 return type; 422 } 423 424 429 public int getDodsType() { 430 String in = getProperty(DODS_TYPE); 431 int type = TYPE_UNKNOWN; 432 433 type = PropUtil.stringToInt(in, TYPE_UNKNOWN); 434 if (type == TYPE_UNKNOWN) { 435 if (Backward.createIsWebApp(getSourcePathArray())) { 436 type = TYPE_WEBAPP; 437 } 438 } 439 return type; 440 } 441 442 447 public void setDeployType(int type) { 448 setProperty(DEPLOY_TYPE, type); 449 } 450 451 456 public void setDodsType(int type) { 457 setProperty(DODS_TYPE, type); 458 } 459 460 public String getDeployResourcePath() { 461 String out = new String (); 462 463 out = getProperty(DEPLOY_PATH_RESOURCE); 464 if ((out == null) || (out.trim().length() == 0)) { 465 out = getSourcePathArray()[0]; 466 } else { 467 out = PathUtil.expandPathRelativeToProject(this, out); 468 } 469 out = PathHandle.createPathString(out); 470 return out; 471 } 472 473 public void setDeployResourcePath(String path) { 474 path = PathUtil.compressPathRelativeToProject(this, path); 475 setProperty(DEPLOY_PATH_RESOURCE, path.replace('\\', '/')); 476 } 477 478 public String getDeployRootPath() { 479 String out = new String (); 480 481 out = getProperty(DEPLOY_PATH_ROOT); 482 if ((out == null) || (out.trim().length() == 0)) { 483 out = getWorkingPath() + File.separator + Constants.DIR_OUTPUT; 484 } else { 485 out = PathUtil.expandPathRelativeToProject(this, out); 486 } 487 return PathHandle.createPathString(out); 488 } 489 490 501 502 public void setDeployRootPath(String path) { 503 path = PathUtil.compressPathRelativeToProject(this, path); 504 setProperty(DEPLOY_PATH_ROOT, path.replace('\\', '/')); 505 } 506 507 512 public boolean isDeployInput() { 513 boolean def = false; 514 int type = getDeployType(); 515 516 if (type == OtterProject.TYPE_EN3APP || 517 type == OtterProject.TYPE_WEBAPP) { 518 def = true; 519 } 520 return readBooleanProperty(DEPLOY_INPUT_ENABLE, def); 521 } 522 523 public void setDeployInput(boolean b) { 524 writeBooleanProperty(DEPLOY_INPUT_ENABLE, b); 525 } 526 527 public boolean isDeployContent() { 528 boolean def = false; 529 int type = getDeployType(); 530 531 if (type == OtterProject.TYPE_EN3APP || 532 type == OtterProject.TYPE_WEBAPP 533 ) { 536 def = true; 537 } 538 539 return readBooleanProperty(DEPLOY_CONTENT_ENABLE, def); 540 } 541 542 public void setDeployContent(boolean b) { 543 writeBooleanProperty(DEPLOY_CONTENT_ENABLE, b); 544 } 545 546 public boolean isDeployRun() { 547 boolean def = true; 548 549 if (getDeployType() == OtterProject.TYPE_UNKNOWN){ 550 def = false; 551 } 552 553 return readBooleanProperty(DEPLOY_RUN_ENABLE, def); 554 } 555 556 public void setDeployRun(boolean b) { 557 writeBooleanProperty(DEPLOY_RUN_ENABLE, b); 558 } 559 560 561 public String getDeployInputPath() { 562 String out = new String (); 563 564 out = getProperty(DEPLOY_PATH_INPUT); 565 if ((out == null) || (out.trim().length() == 0)) { 566 out = getWorkingPath() + File.separator + Constants.DIR_INPUT; 567 out = Backward.createDefaultInputPath(out, getSourcePathArray()); 568 } else { 569 out = PathUtil.expandPathRelativeToProject(this, out); 570 } 571 out = PathHandle.createPathString(out); 572 return out; 573 } 574 575 public void setDeployInputPath(String path) { 576 path = PathUtil.compressPathRelativeToProject(this, path); 577 path = path.replace('\\', '/'); 578 setProperty(DEPLOY_PATH_INPUT, path); 579 } 580 581 587 public boolean isPrintParseInfo() { 588 return readBooleanProperty(XMLC_PRINT_PARSE, false); 589 } 590 591 597 public void setPrintParseInfo(boolean b) { 598 writeBooleanProperty(XMLC_PRINT_PARSE, b); 599 } 600 601 607 public boolean isPrintAccessorInfo() { 608 return readBooleanProperty(XMLC_PRINT_ACCESSOR, false); 609 } 610 611 617 public void setPrintAccessorInfo(boolean b) { 618 writeBooleanProperty(XMLC_PRINT_ACCESSOR, b); 619 } 620 621 627 public boolean isPrintDocumentInfo() { 628 return readBooleanProperty(XMLC_PRINT_DOC, false); 629 } 630 631 637 public void setPrintDocumentInfo(boolean b) { 638 writeBooleanProperty(XMLC_PRINT_DOC, b); 639 } 640 641 647 public boolean isVerbose() { 648 return readBooleanProperty(XMLC_VERBOSE, false); 649 } 650 651 657 public void setVerbose(boolean b) { 658 writeBooleanProperty(XMLC_VERBOSE, b); 659 } 660 661 667 public int getVerifiedMapScope() { 668 int scope = MAP_SCOPE_ALL; 669 670 scope = getMapScope(); 671 672 if (scope == MAP_SCOPE_SELECTED) { 674 OtterXMLCNode[] nodes = new OtterXMLCNode[0]; 675 int mapCount = 0; 676 int type = OtterXMLCNode.CLASS_NAME_MAPPED; 677 678 nodes = getAllXMLCNodes(); 679 if (nodes.length > 0) { 680 for (int i = 0; i < nodes.length; i++) { 681 type = nodes[i].getClassNameType(); 682 if (type == OtterXMLCNode.CLASS_NAME_MAPPED) { 683 mapCount++; 684 } 685 } 686 if (mapCount == 0) { 687 scope = MAP_SCOPE_NONE; 688 setMapScope(MAP_SCOPE_NONE); 689 } else if (mapCount == nodes.length) { 690 scope = MAP_SCOPE_ALL; 691 setMapScope(MAP_SCOPE_ALL); 692 } 693 } 694 nodes = new OtterXMLCNode[0]; 695 } 696 return scope; 697 } 698 699 public int getMapScope() { 700 String strScope; 701 int intScope; 702 703 strScope = getProperty(XMLC_MAP_SCOPE); 704 intScope = PropUtil.stringToInt(strScope, MAP_SCOPE_ALL); 705 return intScope; 706 } 707 708 714 public void setMapScope(int i) { 715 setProperty(XMLC_MAP_SCOPE, i); 716 } 717 718 724 public String getOutputFilename() { 725 String out = null; 726 727 out = getProperty(XMLC_OUTPUT_FILENAME); 728 return out; 729 } 730 731 737 public void setOutputFilename(String n) { 738 setProperty(XMLC_OUTPUT_FILENAME, n); 739 } 740 741 747 public String [][] getPackageMap() { 748 String [][] map = PropUtil.getArrayProperty(this, 749 XMLC_MAP_PACKAGE_LENGTH, 750 XMLC_MAP_PACKAGE_FROM, 751 XMLC_MAP_PACKAGE_TO); 752 File from; 753 754 for (int i = 0; i < map.length; i++) { 755 map[i][0] = PathUtil.expandPathRelativeToProject(this, map[i][0]); 756 } 757 map = MapUtil.optimize(map); 758 return map; 759 } 760 761 766 public void setPackageMap(String [][] map) { 767 map = MapUtil.optimize(map); 768 for (int i = 0; i < map.length; i++) { 769 map[i][0] = PathUtil.compressPathRelativeToProject(this, 770 map[i][0]); 771 } 772 PropUtil.putArrayProperty(this, XMLC_MAP_PACKAGE_LENGTH, 773 XMLC_MAP_PACKAGE_FROM, XMLC_MAP_PACKAGE_TO, 774 map); 775 } 776 777 783 public String [][] getReplacementTable() { 784 String [][] table = PropUtil.getArrayProperty(this, 785 DEPLOY_TABLE_LENGTH, DEPLOY_TABLE_FIND, DEPLOY_TABLE_REPLACE); 786 787 if (table.length == 0) { 789 try { 790 table = ConfigTool.createReplacementStringArray(getRootPath(), 791 getDeployRootPath(), ToolBoxInfo.getJavaPath()); 792 } catch (ToolException e) { 793 table = new String [0][0]; 794 e.printStackTrace(); 795 } 796 table = 797 Backward.createReplacementTable(table, 798 PathUtil.getInputTemplates(this)); 799 } 800 for (int i = 0; i < table.length; i++) { 801 if (table[i][0]!="@ENHYDRA_DIR@") table[i][1] = PathUtil.compressPathRelativeToProject(this,table[i][1]); 803 } 804 return table; 805 } 806 807 812 public void setReplacementTable(String [][] table) { 813 814 for (int i = 0; i < table.length; i++) { 816 if (table[i][0]!="@ENHYDRA_DIR@") table[i][1] = PathUtil.compressPathRelativeToProject(this,table[i][1]); 818 } 819 PropUtil.putArrayProperty(this, DEPLOY_TABLE_LENGTH, 820 DEPLOY_TABLE_FIND, DEPLOY_TABLE_REPLACE, 821 table); 822 } 823 824 830 public String getGenerateToDirectory() { 831 String genToDir = null; 832 833 if (readBooleanProperty(PropertyKeys.NAME_GENTO, true)) { 834 genToDir = getClassOutputPath() + File.separator 835 + Constants.DIR_GEN_SOURCE; 836 } 837 return genToDir; 838 } 839 840 846 public boolean isDeployOverwrite() { 847 String in = getProperty(DEPLOY_OVERWRITE); 848 849 return PropUtil.stringToBoolean(in, true); 850 } 851 852 858 public boolean isDodsOverwrite() { 859 String in = getProperty(DODS_OVERWRITE); 860 861 return PropUtil.stringToBoolean(in, true); 862 } 863 864 870 public void setDeployOverwrite(boolean b) { 871 setProperty(DEPLOY_OVERWRITE, PropUtil.booleanToString(b)); 872 } 873 874 880 public void setDodsOverwrite(boolean b) { 881 setProperty(DODS_OVERWRITE, PropUtil.booleanToString(b)); 882 } 883 884 890 public boolean isDeployInputFilter() { 891 String in = getProperty(DEPLOY_INPUT_FILTER); 892 boolean inFilter = false; 893 894 inFilter = PathUtil.isInputInSource(this); 895 if (!inFilter) { 896 inFilter = PropUtil.stringToBoolean(in, false); 897 } 898 return inFilter; 899 } 900 901 907 public void setDeployInputFilter(boolean b) { 908 boolean inFilter = false; 909 910 inFilter = PathUtil.isInputInSource(this); 911 if (inFilter) { 912 b = true; 913 } 914 setProperty(DEPLOY_INPUT_FILTER, PropUtil.booleanToString(b)); 915 } 916 917 923 public boolean isDeployStartupRun() { 924 String in = getProperty(DEPLOY_STARTUP_RUN); 925 926 return PropUtil.stringToBoolean(in, true); 927 } 928 929 935 public void setDeployStartupRun(boolean b) { 936 setProperty(DEPLOY_STARTUP_RUN, PropUtil.booleanToString(b)); 937 } 938 939 public boolean isDeployStartupJavaReadOnly() { 940 return false; 941 } 942 943 949 public boolean isDeployStartupJava() { 950 boolean javaStartup = false; 951 String in = getProperty(DEPLOY_STARTUP_JAVA); 952 953 javaStartup = PropUtil.stringToBoolean(in, !isOpenBuild()); 954 return javaStartup; 955 } 956 957 963 public void setDeployStartupJava(boolean b) { 964 setProperty(DEPLOY_STARTUP_JAVA, PropUtil.booleanToString(b)); 965 } 966 967 973 public String getDeployBootstrapPath() { 974 PathHandle ph = null; 975 File file = null; 976 977 file = PathUtil.getFileRelativeToProject(this, DEPLOY_PATH_BOOTSTRAP); 978 ph = PathHandle.createPathHandle(file); 979 if (ph.isEmpty()) { 980 ph = 981 PathHandle.createPathHandle(PathUtil.getDefaultDeployBootstrapPath(this)); 982 } 983 return ph.getPath(); 984 } 985 986 992 public void setDeployBootstrapPath(String path) { 993 PathUtil.putFileRelativeToProject(this, DEPLOY_PATH_BOOTSTRAP, path); 994 } 995 996 1002 public void setDodsBootstrapPath(String path) { 1003 PathUtil.putFileRelativeToProject(this, DODS_PATH_BOOTSTRAP, path); 1004 } 1005 1006 public void setArchivePlans(JarPlan[] plans) { 1007 PropertyWriter writer = null; 1008 1009 writer = new PropertyWriter(); 1010 writer.write(plans, getArchivePH().getFile()); 1011 } 1012 1013 public JarPlan[] getArchivePlans(boolean validate) { 1014 PropertyReader reader = null; 1015 JarPlan[] plans = null; 1016 1017 reader = new PropertyReader(); 1018 reader.setValidate(validate); 1019 if (getArchivePH().isFile()) { 1020 try { 1021 plans = reader.read(getArchivePH().getFile()); 1022 } catch (IOException e) { 1023 e.printStackTrace(System.err); 1024 plans = null; 1025 } 1026 } 1027 if (plans == null) { 1028 plans = reader.read(defaultArchiveProperties()); 1029 } 1030 return plans; 1031 } 1032 1033 public String getAutoDeployFilePath() { 1034 String path = new String (); 1035 StringBuffer buf = new StringBuffer (); 1036 PathHandle ph = null; 1037 JarPlan[] plans = new JarPlan[0]; 1038 int dep = 0; 1039 1040 path = getProperty(PropertyKeys.AUTO_DEPLOY_FILE); 1041 ph = PathHandle.createPathHandle(path); 1042 if (ph.isEmpty()) { 1043 if (getDeployType() == OtterProject.TYPE_EN3APP) { 1044 buf.append(PathUtil.getDeployConfPath(this)); 1045 buf.append(File.separator); 1046 buf.append(getProjectRootName()); 1047 buf.append(".conf"); 1048 path = PathHandle.createPathString(buf.toString()); 1049 } else { 1050 plans = getArchivePlans(false); 1051 if (plans.length > 0) { 1052 path = plans[plans.length - 1].getArchivePath(); 1053 } 1054 } 1055 } else { 1056 path = ph.getPath(); 1057 } 1058 return path; 1059 } 1060 1061 public void setAutoDeployFile(String path) { 1062 setProperty(PropertyKeys.AUTO_DEPLOY_FILE, 1063 PathHandle.createPathString(path)); 1064 } 1065 1066 1069 public boolean isDeployBuild() { 1070 return readBooleanProperty(DEPLOY_BUILD, false); 1071 } 1072 1073 1076 public void setDeployBuild(boolean b) { 1077 writeBooleanProperty(DEPLOY_BUILD, b); 1078 } 1079 1080 1083 public void setDodsBuild(boolean b) { 1084 writeBooleanProperty(DODS_BUILD, b); 1085 } 1086 1087 1090 public boolean isDeployEcho() { 1091 return readBooleanProperty(DEPLOY_ECHO, true); 1092 } 1093 1094 1097 public boolean isDodsEcho() { 1098 return readBooleanProperty(DODS_ECHO, true); 1099 } 1100 1101 1104 public void setDeployEcho(boolean b) { 1105 writeBooleanProperty(DEPLOY_ECHO, b); 1106 } 1107 1108 1111 public void setDodsEcho(boolean b) { 1112 writeBooleanProperty(DODS_ECHO, b); 1113 } 1114 1115 1123 public String getSourcePathOf(OtterFileNode node) { 1124 String out = new String (); 1125 String filePath = node.getFilePath(); 1126 1127 out = PathUtil.getSourcePathOf(this, filePath); 1128 return out; 1129 } 1130 1131 1138 protected void writeBooleanProperty(String property, boolean b) { 1139 String flag = b ? Boolean.TRUE.toString() : Boolean.FALSE.toString(); 1140 1141 setProperty(property, flag); 1142 } 1143 1144 1152 protected boolean readBooleanProperty(String property, boolean def) { 1153 boolean flag = def; 1154 String in = getProperty(property); 1155 1156 return PropUtil.stringToBoolean(in, def); 1157 } 1158 1159 public boolean isSelected() { 1160 return false; 1161 } 1162 1163 public void setSelected(boolean b) {} 1164 1165 public void setException(Throwable e) {} 1166 1167 public Throwable getException() { 1168 return null; 1169 } 1170 1171 private PathHandle getArchivePH() { 1172 PathHandle ph = null; 1173 StringBuffer buf = new StringBuffer (); 1174 1175 buf.append(getRootPath()); 1176 buf.append(File.separator); 1177 buf.append("archive.properties"); 1178 ph = PathHandle.createPathHandle(buf.toString()); 1179 return ph; 1180 } 1181 1182 private Properties defaultArchiveProperties() { 1183 Descriptor[] dd = new Descriptor[0]; 1184 JarPlan plan = null; 1185 PropertyWriter writer = null; 1186 Properties props = new Properties (); 1187 int type = getDeployType(); 1188 1189 try { 1190 switch (type) { 1191 case TYPE_WEBAPP: 1192 WarPlan wp = new WarPlan(); 1193 1194 wp.setValidate(false); 1195 wp.setContentRoot(PathUtil.getDeployContentPath(this)); 1196 dd = new Descriptor[1]; 1197 dd[0] = new Descriptor(true, Descriptor.WEB); 1198 dd[0].setPath(getSourcePathArray()[0] + "/WEB-INF/web.xml"); 1199 plan = wp; 1200 break; 1201 case TYPE_EN3APP: 1202 plan = new JarPlan(); 1203 plan.setValidate(false); 1204 break; 1205 1214 } 1215 if (plan != null) { 1216 plan.setDescriptors(dd); 1217 plan.setClassRoot(getClassOutputPath()); 1218 plan.setArchivePath(PathUtil.getDefaultDeployArchivePath(this)); 1219 writer = new PropertyWriter(); 1220 props = writer.write(plan); 1221 } 1222 } catch (ArchiveException e) { 1223 e.printStackTrace(System.err); 1224 if (props == null) { 1225 props = new Properties (); 1226 } 1227 } 1228 return props; 1229 } 1230 1231 1236 public void setDodsParameters(String p) { 1237 setProperty(NAME_DODS_PARAMETERS, p); 1238 } 1239 1240 1246 public String getDodsParameters() { 1247 return getProperty(NAME_DODS_PARAMETERS); 1248 } 1249 1250 1256 public void setDomlFilePath(String path) { 1257 setProperty(NAME_DOML_FILEPATH, path); 1258 } 1259 1260 1266 public String getDomlFilePath() { 1267 return getProperty(NAME_DOML_FILEPATH); 1268 } 1269 1270 1276 public String getEnhydraPath() { 1277 return getProperty(DODS_ENHYDRA_PATH); 1278 } 1279 1280 1286 public String getProjectJavaPath() { 1287 return getProperty(DODS_PROJECT_JAVA_PATH); 1288 } 1289 1290 1296 public void setDodsRootPath(String path) { 1297 setProperty(NAME_DODS_ROOTPATH, path); 1298 } 1299 1300 1306 public String getDodsRootPath() { 1307 return getProperty(NAME_DODS_ROOTPATH); 1308 } 1309 1310 1316 1319 1320 1326 1329 1330 1336 public void setDODSGenerator(DODSGenerator gen) { 1337 generator = gen; 1338 } 1339 1345 public DODSGenerator getDODSGenerator() { 1346 return generator; 1347 } 1348 1349 1355 public void setDocumentationHtml(String html) { 1356 setProperty(NAME_DODS_DOCUMENTATION_HTML, html); 1357 } 1358 1364 public String getDocumentationHtml() { 1365 return getProperty(NAME_DODS_DOCUMENTATION_HTML); 1366 } 1367 1368 1374 public void setDocumentationPdf(String pdf) { 1375 setProperty(NAME_DODS_DOCUMENTATION_PDF, pdf); 1376 } 1377 1383 public String getDocumentationPdf() { 1384 return getProperty(NAME_DODS_DOCUMENTATION_PDF); 1385 } 1386 1387 1393 public void setDocumentationXmi(String xmi) { 1394 setProperty(NAME_DODS_DOCUMENTATION_XMI, xmi); 1395 } 1396 1402 public String getDocumentationXmi() { 1403 return getProperty(NAME_DODS_DOCUMENTATION_XMI); 1404 } 1405 1406 1412 public void setDocumentationPtl(String ptl) { 1413 setProperty(NAME_DODS_DOCUMENTATION_PTL, ptl); 1414 } 1415 1421 public String getDocumentationPtl() { 1422 return getProperty(NAME_DODS_DOCUMENTATION_PTL); 1423 } 1424 1425 1431 public void setTemplateSet(String temp) { 1432 setProperty(NAME_DODS_TEMPLATE_SET, temp); 1433 } 1434 1440 public String getTemplateSet() { 1441 return getProperty(NAME_DODS_TEMPLATE_SET); 1442 } 1443 1444} | Popular Tags |