1 23 24 30 31 package com.sun.enterprise.deployment.autodeploy; 32 33 import com.sun.enterprise.deployment.deploy.shared.AbstractArchive; 34 import com.sun.enterprise.deployment.deploy.shared.AbstractArchiveFactory; 35 import com.sun.enterprise.deployment.deploy.shared.ArchiveFactory; 36 import java.io.File ; 37 import java.io.PrintWriter ; 38 import java.io.ByteArrayOutputStream ; 39 40 import java.util.logging.Logger ; 41 import java.util.logging.Level ; 42 import java.util.Properties ; 43 import javax.management.ObjectName ; 44 import javax.management.MBeanServer ; 45 import javax.management.MBeanException ; 46 import com.sun.enterprise.admin.server.core.jmx.InitException; 47 import com.sun.enterprise.admin.common.ObjectNames; 48 import com.sun.enterprise.admin.common.constant.DeploymentConstants; 49 import com.sun.enterprise.config.serverbeans.HttpService; 50 import com.sun.enterprise.config.serverbeans.HttpListener; 51 import com.sun.enterprise.config.serverbeans.Server; 52 import com.sun.enterprise.config.serverbeans.Domain; 53 import com.sun.enterprise.config.serverbeans.Configs; 54 import com.sun.enterprise.config.serverbeans.Servers; 55 import com.sun.enterprise.config.serverbeans.ServerBeansFactory; 56 import com.sun.enterprise.config.serverbeans.Config; 57 import com.sun.enterprise.config.ConfigContext; 58 import com.sun.enterprise.config.ConfigException; 59 import com.sun.enterprise.config.ConfigFactory; 60 import com.sun.enterprise.instance.InstanceEnvironment; 61 import com.sun.enterprise.util.i18n.StringManager; 62 import com.sun.enterprise.instance.ServerManager; 63 import com.sun.enterprise.server.ServerContext; 64 import com.sun.enterprise.admin.server.core.AdminService; 65 import com.sun.enterprise.admin.common.MBeanServerFactory; 66 import com.sun.enterprise.config.ConfigContext; 67 import com.sun.enterprise.deployment.util.DeploymentProperties; 68 import com.sun.enterprise.deployment.backend.DeploymentStatus; 69 import java.util.Properties ; 70 import java.util.HashMap ; 71 import java.util.Date ; 72 import java.io.IOException ; 73 80 public class AutoDeployer { 81 82 private ObjectName mbeanName = null; 83 private MBeanServer mbs=null; 84 85 private Boolean verify=null; 86 private Boolean forceDeploy=null; 87 private Boolean enabled=null; 88 private Boolean jspPreCompilation=null; 89 private boolean renameOnSuccess = true; 90 91 private String targetInstance=null; 92 private static final Logger sLogger=AutoDeployControllerImpl.sLogger; 93 private static StringManager localStrings = 94 StringManager.getManager( AutoDeployer.class ); 95 private DirectoryScanner directoryScanner=null; 96 97 private boolean cancelDeployment =false; 98 99 108 protected static final int DEPLOY_SUCCESS = 1; 109 protected static final int DEPLOY_FAILURE = 2; 110 protected static final int DEPLOY_PENDING = 3; 111 112 116 private final AbstractArchiveFactory archiveFactory = new ArchiveFactory(); 117 118 private AutodeployRetryManager retryManager = new AutodeployRetryManager(); 119 121 public AutoDeployer() { 122 123 verify= new Boolean (false); 125 jspPreCompilation=new Boolean (false); 126 forceDeploy=new Boolean (true); 127 enabled=new Boolean (true); 128 } 129 130 132 public AutoDeployer(boolean verify, boolean jspPreCompilation) { 133 134 this.verify= new Boolean (verify); 136 this.jspPreCompilation=new Boolean (jspPreCompilation); 137 forceDeploy=new Boolean (true); 138 enabled=new Boolean (true); 139 } 140 141 145 public void setDirectoryScanner(DirectoryScanner ds) { 146 directoryScanner=ds; 147 } 148 149 153 public void setTarget(String target) { 154 this.targetInstance = target; 155 mbeanName = getMBean(targetInstance); 156 } 157 158 162 public void disableRenameOnSuccess() { 163 renameOnSuccess = false; 164 } 165 166 170 public void enableRenameOnSuccess() { 171 renameOnSuccess = true; 173 } 174 175 179 public void setVerify(boolean verify) { 180 this.verify = new Boolean (verify); 181 } 182 183 187 public void setJspPreCompilation(boolean jspPreCompilation) { 188 this.jspPreCompilation = new Boolean (jspPreCompilation); 189 } 190 191 195 public void deployAll(File autoDeployDir , boolean verify, boolean jspPreCompilation) throws AutoDeploymentException { 196 this.verify= new Boolean (verify); 197 this.jspPreCompilation=new Boolean (jspPreCompilation); 198 deployAll(autoDeployDir); 199 } 200 201 205 public void deployAll(File autoDeployDir) throws AutoDeploymentException { 206 deployAll(autoDeployDir, false); 207 } 208 209 213 public void deployAll(File autoDeployDir, boolean includeSubDir) throws AutoDeploymentException { 214 215 216 if(directoryScanner==null) { 218 directoryScanner=new AutoDeployDirectoryScanner(); 219 } 220 221 if(this.targetInstance == null) { 223 setTarget(getDefaultTarget()); 224 } 225 226 File [] files= null; 227 228 files= directoryScanner.getAllDeployableModules(autoDeployDir, includeSubDir); 230 231 249 if(files != null) { 250 for (int i=0; ((i < files.length) && !cancelDeployment);i++) { 251 boolean okToRecordResult = true; 252 try { 253 okToRecordResult = (deploy(files[i], getNameFromFilePath(autoDeployDir, files[i])) != DEPLOY_PENDING); 254 } catch (AutoDeploymentException ae) { 255 } finally { 257 if(renameOnSuccess && okToRecordResult) 258 directoryScanner.deployedEntity(autoDeployDir, files[i]); 259 } 260 } 261 } 262 } 263 264 265 266 270 public void undeployAll(File autoDeployDir) throws AutoDeploymentException { 271 272 273 if(directoryScanner==null) { 275 directoryScanner=new AutoDeployDirectoryScanner(); 276 } 277 278 if(mbs == null) { 279 mbs = getMBeanServer(); 280 } 281 if(this.targetInstance == null) { 283 setTarget(getDefaultTarget()); 284 } 285 286 File [] apps= null; 287 288 apps= directoryScanner.getAllFilesForUndeployment(autoDeployDir); 290 291 if(apps !=null) { 293 for (int i=0; i< apps.length && !cancelDeployment;i++) { 294 try { 295 296 boolean stat = this.undeployApplication(apps[i], getNameFromFilePath(autoDeployDir, apps[i])); 297 if (stat) 298 markUndeployed(apps[i]); 299 else 300 markUndeployFailed(apps[i]); 301 302 303 } catch (AutoDeploymentException ae) { 304 markUndeployFailed(apps[i]); 306 } finally { 307 directoryScanner.undeployedEntity(autoDeployDir, apps[i]); 309 } 310 } 311 } 312 } 314 private boolean undeployApplication(File applicationFile, String name) throws AutoDeploymentException { 315 boolean status = false; 316 317 Properties props = getUndeployActionProperties(name); 318 319 String [] signature = new String []{"java.util.Properties"}; 320 321 Object [] params = new Object []{props}; 322 sLogger.log(Level.INFO, "Autoundeploying application :" + name); 323 status = invokeUndeploymentService(applicationFile.getAbsolutePath(), AutoDeployConstants.UNDEPLOY_METHOD,params,signature);; 324 String msg = localStrings.getString("enterprise.deployment.autodeploy.autoundeploying_application",applicationFile); 325 sLogger.log(Level.INFO, msg); 326 return status; 327 328 } 329 330 335 public void setCancel(boolean value){ 336 cancelDeployment=value; 337 } 338 339 343 public boolean isCancelled(){ 344 return cancelDeployment; 345 } 346 347 350 351 void init() throws AutoDeploymentException{ 352 getMBeanServer(); 354 355 if(targetInstance == null) { 356 setTarget(getDefaultTarget()); 358 } 359 } 360 361 368 protected int deploy(File deployablefile, String name) throws AutoDeploymentException { 369 370 int status=DEPLOY_FAILURE; 371 if(cancelDeployment) { 372 return status; 373 } 374 String file=deployablefile.getAbsolutePath(); 375 status = retryManager.testFileAsArchive(file); 376 if (status != DEPLOY_SUCCESS) { 377 return status; 378 } 379 380 if (isModuleDeployed(name)) { 382 boolean result = undeployApplication(deployablefile, name); 383 if (!result) { 384 return DEPLOY_FAILURE; 385 } 386 } 387 388 Properties props = getDeployActionProperties(deployablefile,name); 389 String [] signature = new String []{"java.util.Properties"}; 390 391 Object [] params = new Object []{props}; 392 393 if (invokeDeploymentService(deployablefile, AutoDeployConstants.DEPLOY_METHOD,params,signature)) { 395 status = DEPLOY_SUCCESS; 396 } else { 397 status = DEPLOY_FAILURE; 398 } 399 return status; 400 } 401 402 boolean invokeDeploymentService(File deployablefile, String action, 403 Object [] params,String [] signature) throws AutoDeploymentException { 404 405 String file=deployablefile.getAbsolutePath(); 406 boolean status=false; 407 408 String msg = localStrings.getString("enterprise.deployment.autodeploy.selecting_file",deployablefile.getAbsolutePath()); 409 sLogger.log(Level.INFO, msg); 410 411 try { 413 Object result=getMBeanServer().invoke(getMBeanName(),action, params,signature); 414 status =parseResult(result); 415 } catch (Exception e) { 416 while (e instanceof MBeanException ) { 417 e = ((MBeanException )e).getTargetException(); 418 } 419 status = false; 420 msg = localStrings.getString("enterprise.deployment.autodeploy.invocation_exception",file); 421 AutoDeploymentException ae; 422 ae=new AutoDeploymentException(msg, e); 423 sLogger.log(Level.INFO, ae.getMessage()); 424 throw ae; 425 } finally { 426 if(status) { 427 if(renameOnSuccess) 428 markDeployed(deployablefile); 429 msg = localStrings.getString("enterprise.deployment.autodeploy.successfully_autodeployed",file); 430 sLogger.log(Level.INFO, msg); 431 } else { 432 markDeployFailed(deployablefile); 433 msg = localStrings.getString("enterprise.deployment.autodeploy.autodeploy_failed",file); 435 sLogger.log(Level.INFO, msg); 436 } 437 438 } 439 return status; 440 441 } 442 443 447 448 final ObjectName getMBeanName() throws AutoDeploymentException { 449 if(mbeanName == null) 450 throw new AutoDeploymentException("Internal Error: mbeanName is null"); 451 452 return mbeanName; 453 } 454 455 462 463 final MBeanServer getMBeanServer() throws AutoDeploymentException { 464 if(mbs == null) 465 mbs = MBeanServerFactory.getMBeanServer(); 466 467 return mbs; 468 } 469 470 471 private ObjectName getMBean(String instanceName) { 472 ObjectName mbean=null; 473 try { 475 mbean = new ObjectName ("com.sun.appserv:type=applications,category=config"); 476 } catch(Exception e) { 477 sLogger.log(Level.SEVERE, "enterprise.deployment.backend.autoDeploymentFailure", 478 new Object [] {e.getMessage()}); 479 } 480 return mbean; 481 482 } 483 484 private boolean isModuleDeployed (String moduleID) { 485 if (moduleID == null) { 486 return false; 487 } 488 489 try { 490 String [] signature = new String [] {"java.lang.String"}; 491 Object [] params = new Object [] {moduleID}; 492 Object result = getMBeanServer().invoke(getMBeanName(), 493 "getModuleType", params, signature); 494 495 if (result != null) { 496 return true; 497 } 498 return false; 499 } catch (Exception e) { 500 return false; 501 } 502 } 503 504 private String getDefaultVirtualServer(String instanceName) { 505 String virtualServer=null; 506 try { 507 ConfigContext context = getConfigContext(); 508 HttpService service = ServerBeansFactory.getHttpServiceBean(context); 511 if(service !=null){ 512 HttpListener[] hlArray = service.getHttpListener(); 513 HttpListener ls = null; 516 if(hlArray != null && hlArray.length > 0){ 517 ls=hlArray[0]; 518 for(int i = 0;i<hlArray.length;i++) { 520 if(hlArray[i].isEnabled()) { 521 ls = hlArray[i]; 522 break; 523 } 524 } 525 } 526 if(ls!=null) 527 virtualServer = ls.getDefaultVirtualServer(); 528 } 529 } catch(ConfigException e){ 530 String msg = localStrings.getString("enterprise.deployment.autodeploy.unable_to_get_virtualserver"); 531 sLogger.log(Level.WARNING, msg+e.getMessage()); 532 } catch(Exception e){String msg = localStrings.getString("enterprise.deployment.autodeploy.unable_to_get_virtualserver"); 533 sLogger.log(Level.WARNING, msg+e.getMessage()); 534 } 535 536 return virtualServer; 537 538 } 539 540 private String getDefaultTarget() throws AutoDeploymentException { 541 try{ 542 ConfigContext confContext = getConfigContext(); 543 Domain domain = (Domain)confContext.getRootConfigBean(); 544 Servers svrs = domain.getServers(); 545 Server [] svrArr = svrs.getServer(); 546 int size = svrArr.length; 547 String targetName = null; 548 551 for(int i = 0 ; i< size; i++) { 552 if(!svrArr[i].getName().equals("")) { 553 targetName = svrArr[i].getName(); 554 break; 555 } 556 } 557 if(targetName == null) { 558 sLogger.log(Level.SEVERE, "enterprise.deployment.backend.autoDeploymentFailure", 559 new Object [] {"Target server not found"}); 560 throw new AutoDeploymentException("Target Server not found"); 561 } 562 563 return targetName; 564 }catch(Exception ex) { 565 return null; 566 } 567 } 568 569 570 private ConfigContext getConfigContext() throws ConfigException { 571 577 ServerContext serverContext = AdminService.getAdminService().getContext(); 578 ConfigContext context = serverContext.getConfigContext(); 579 return context; 580 } 581 582 583 584 protected boolean parseResult(Object result) { 585 if(result!=null && result instanceof DeploymentStatus) { 586 DeploymentStatus status = (DeploymentStatus) result; 587 if (status.getStatus()>DeploymentStatus.WARNING) { 588 return true; 589 } else { 590 ByteArrayOutputStream bos = 593 new ByteArrayOutputStream (); 594 PrintWriter pw = new PrintWriter (bos); 595 DeploymentStatus.parseDeploymentStatus(status, pw); 596 byte[] statusBytes = bos.toByteArray(); 597 String statusString = new String (statusBytes); 598 599 if (status.getStatus()==DeploymentStatus.WARNING) { 600 String msg = localStrings.getString( 602 "enterprise.deployment.warning_occured", statusString); 603 sLogger.log(Level.WARNING, msg); 604 return true; 606 } else if (status.getStatus()==DeploymentStatus.FAILURE) { 607 sLogger.log(Level.SEVERE, "enterprise.deployment.backend.autoDeploymentFailure", 608 new Object [] {statusString}); 609 return false; 610 } 611 } 612 } 613 return false; 614 } 615 616 static String getNameFromFilePath(File autodeployDir, File filePath) { 618 File parent = filePath.getParentFile(); 619 String moduleName = null; 620 while (!parent.getAbsolutePath().equals(autodeployDir.getAbsolutePath())) { 621 if (moduleName==null) { 622 moduleName = parent.getName(); 623 } else { 624 moduleName = parent.getName()+"_"+moduleName; 625 } 626 parent = parent.getParentFile(); 627 } 628 if (moduleName==null) { 629 moduleName = filePath.getName(); 630 } else { 631 moduleName = moduleName + "_" + filePath.getName(); 632 } 633 int toIndex = moduleName.lastIndexOf('.'); 634 if (toIndex > 0) { 635 moduleName = moduleName.substring(0, toIndex); 636 } 637 return moduleName; 638 } 639 640 protected void markDeployed(File f) { 642 try { 643 deleteAllMarks(f); 644 getDeployedFile(f).createNewFile(); 645 } catch (Exception e) {} 646 } 647 648 protected void markDeployFailed(File f) { 649 try { 650 deleteAllMarks(f); 651 getDeployFailedFile(f).createNewFile(); 652 } catch (Exception e) {} 653 } 654 655 protected void markUndeployed(File f) { 656 try { 657 deleteAllMarks(f); 658 getUndeployedFile(f).createNewFile(); 659 } catch (Exception e) {} 660 } 661 662 protected void markUndeployFailed(File f) { 663 try { 664 deleteAllMarks(f); 665 getUndeployFailedFile(f).createNewFile(); 666 } catch (Exception e) {} 667 } 668 669 protected void deleteAllMarks(File f) { 670 try { 671 getDeployedFile(f).delete(); 672 getDeployFailedFile(f).delete(); 673 getUndeployedFile(f).delete(); 674 getUndeployFailedFile(f).delete(); 675 } catch (Exception e) {} 676 } 677 678 protected File getDeployedFile(File f) { 679 String absPath = f.getAbsolutePath(); 680 File ret = new File (absPath + AutoDeployConstants.DEPLOYED); 681 return ret; 682 } 683 684 protected File getDeployFailedFile(File f) { 685 String absPath = f.getAbsolutePath(); 686 File ret = new File (absPath + AutoDeployConstants.DEPLOY_FAILED); 687 return ret; 688 } 689 690 protected File getUndeployedFile(File f) { 691 String absPath = f.getAbsolutePath(); 692 File ret = new File (absPath + AutoDeployConstants.UNDEPLOYED); 693 return ret; 694 } 695 696 protected File getUndeployFailedFile(File f) { 697 String absPath = f.getAbsolutePath(); 698 File ret = new File (absPath + AutoDeployConstants.UNDEPLOY_FAILED); 699 return ret; 700 } 701 702 private boolean invokeUndeploymentService(String appFile, String action, 703 Object [] params,String [] signature) throws AutoDeploymentException { 704 705 boolean status=false; 706 try { 708 Object result=getMBeanServer().invoke(getMBeanName(),action, params,signature); 709 status =parseResult(result); 710 } catch (Exception e) { 711 while (e instanceof MBeanException ) { 712 e = ((MBeanException )e).getTargetException(); 713 } 714 status = false; 715 String msg = localStrings.getString("enterprise.deployment.autodeploy.invocation_exception",appFile); 716 AutoDeploymentException ae; 717 ae=new AutoDeploymentException(msg, e); 718 sLogger.log(Level.INFO, ae.getMessage()); 719 throw ae; 720 } finally { 721 if(status) { 722 String msg = localStrings.getString("enterprise.deployment.autodeploy.successfully_autoundeployed",appFile); 723 sLogger.log(Level.INFO, msg); 724 } else { 725 String msg = localStrings.getString("enterprise.deployment.autodeploy.autoundeploy_failed",appFile); 726 sLogger.log(Level.INFO, msg); 727 } 728 729 } 730 return status; 731 732 } 733 734 735 736 protected Properties getDeployActionProperties(File deployablefile, String ID){ 737 738 DeploymentProperties dProps = new DeploymentProperties(); 739 dProps.setArchiveName(deployablefile.getAbsolutePath()); 740 dProps.setName(ID); 741 dProps.setEnable(enabled.booleanValue()); 742 dProps.setVirtualServers(getDefaultVirtualServer(targetInstance)); 743 dProps.setForce(forceDeploy.booleanValue()); 744 dProps.setVerify(verify.booleanValue()); 745 dProps.setPrecompileJSP(jspPreCompilation.booleanValue()); 746 dProps.setResourceAction(DeploymentProperties.RES_DEPLOYMENT); 747 dProps.setResourceTargetList("server"); 748 749 return (Properties )dProps; 750 } 751 752 protected Properties getUndeployActionProperties(String name){ 753 DeploymentProperties dProps = new DeploymentProperties(); 754 dProps.setName(name); 755 dProps.setResourceAction(DeploymentProperties.RES_UNDEPLOYMENT); 756 dProps.setResourceTargetList("server"); 757 758 return (Properties )dProps; 759 } 760 761 786 class AutodeployRetryManager { 787 788 791 private final String RETRY_LIMIT_NAME = "com.sun.appserv.autodeploy.retry.limit"; 792 private final long RETRY_LIMIT_DEFAULT = 30 * 1000; private final long RETRY_LIMIT = Long.getLong(RETRY_LIMIT_NAME, RETRY_LIMIT_DEFAULT).longValue(); 794 795 796 private HashMap invalidFiles = new HashMap (); 797 798 807 class Info { 808 809 private File file = null; 810 811 813 private long recordedLength = 0; 814 815 816 private long retryExpiration = 0; 817 818 822 public Info(File file) { 823 this.file = file; 824 update(); 825 } 826 827 831 private void update() { 832 long currentLength = file.length(); 833 if (recordedLength != currentLength) { 834 838 long now = new Date ().getTime(); 839 retryExpiration = now + RETRY_LIMIT; 840 } 841 845 recordedLength = currentLength; 846 } 847 848 857 private boolean isEligibleForRetry() { 858 long now = new Date ().getTime(); 859 boolean result = (now < retryExpiration); 860 return result; 861 } 862 863 } 864 865 878 int testFileAsArchive(String file) throws AutoDeploymentException { 879 int result; 880 try { 881 File inFile = new File (file); 882 if (!inFile.isDirectory()) { 883 if (file.endsWith(".class")) { 885 return DEPLOY_SUCCESS; 886 } 887 } 888 AbstractArchive arch = openFileAsArchive(file); 889 if (arch != null) { 890 result = DEPLOY_SUCCESS; 891 arch.close(); 892 } else { 893 result = DEPLOY_PENDING; 894 } 895 } catch (AutoDeploymentException ade) { 896 result = DEPLOY_FAILURE; 897 } catch (IOException ioe) { 898 String msg = localStrings.getString("enterprise.deployment.autodeploy.error_closing_archive", file); 899 throw new AutoDeploymentException(msg, ioe); 900 } 901 return result; 902 } 903 904 912 AbstractArchive openFileAsArchive(String file) throws AutoDeploymentException { 913 AbstractArchive archive = null; 914 File f = new File (file); 915 if (shouldOpen(f)) { 916 try { 917 921 archive = archiveFactory.openArchive(file); 922 923 recordSuccessfulOpen(f); 924 925 } catch (IOException ioe) { 926 String errorMsg = null; 927 931 if (archive == null) { 932 boolean failedPreviously = recordFailedOpen(f); 933 if ( ! failedPreviously) { 934 Info info = get(f); 935 errorMsg = localStrings.getString("enterprise.deployment.autodeploy.error_opening_start_retry", file, new Date (info.retryExpiration).toString()); 936 sLogger.log(Level.INFO, errorMsg); 937 } 938 } 939 } 940 } 941 return archive; 942 } 943 944 950 Info get(File file) { 951 Info info = (Info) invalidFiles.get(file); 952 return info; 953 } 954 955 964 private boolean shouldOpen(File file) { 965 boolean result = true; String msg = null; 967 boolean loggable = sLogger.isLoggable(Level.FINE); 968 Info info = (Info) invalidFiles.get(file); 969 if (info != null) { 970 result = (file.length() == info.recordedLength); 971 if (loggable) { 972 if (result) { 973 msg = localStrings.getString("enterprise.deployment.autodeploy.try_stable_length", file.getAbsolutePath()); 974 } else { 975 msg = localStrings.getString("enterprise.deployment.autodeploy.no_try_unstable_length", file.getAbsolutePath(), String.valueOf(file.length())); 976 } 977 } 978 info.update(); 979 } else { 980 if (loggable) { 981 msg = localStrings.getString("enterprise.deployment.autodeploy.try_not_monitored", file.getAbsolutePath()); 982 } 983 } 984 if (loggable) { 985 sLogger.log(Level.FINE, msg); 986 } 987 return result; 988 } 989 990 997 private boolean recordFailedOpen(File file) throws AutoDeploymentException { 998 boolean fileAlreadyPresent; 999 1002 Info info = get(file); 1003 if (info == null) { 1004 1008 fileAlreadyPresent = false; 1009 info = new Info(file); 1010 invalidFiles.put(file, info); 1011 if (sLogger.isLoggable(Level.FINE)) { 1012 String msg = localStrings.getString("enterprise.deployment.autodeploy.begin_monitoring", file.getAbsolutePath(), new Date (info.retryExpiration).toString()); 1013 sLogger.log(Level.FINE, msg); 1014 } 1015 } else { 1016 1020 fileAlreadyPresent = true; 1021 info.update(); 1022 1023 1029 boolean loggable = sLogger.isLoggable(Level.FINE); 1030 if (info.isEligibleForRetry()) { 1031 1034 if (loggable) { 1035 String msg = localStrings.getString("enterprise.deployment.autodeploy.continue_monitoring", file.getAbsolutePath(), new Date (info.retryExpiration).toString()); 1036 sLogger.log(Level.FINE, msg); 1037 } 1038 } else { 1039 1044 String msg = localStrings.getString("enterprise.deployment.autodeploy.abort_monitoring", 1045 file.getAbsolutePath(), String.valueOf(RETRY_LIMIT)); 1046 if (loggable) { 1047 sLogger.log(Level.FINE, msg); 1048 } 1049 invalidFiles.remove(file); 1050 throw new AutoDeploymentException(msg); 1051 } 1052 } 1053 return fileAlreadyPresent; 1054 } 1055 1056 1061 private boolean recordSuccessfulOpen(File file) { 1062 if (sLogger.isLoggable(Level.FINE)) { 1063 String msg = localStrings.getString("enterprise.deployment.autodeploy.end_monitoring", file.getAbsolutePath()); 1064 sLogger.log(Level.FINE, msg); 1065 } 1066 return (invalidFiles.remove(file)) != null; 1067 } 1068 } 1069 1070 1071 1072} 1073 1074 | Popular Tags |