1 23 24 package com.sun.enterprise.connectors; 25 26 import java.util.*; 27 import java.util.logging.*; 28 import javax.naming.*; 29 import com.sun.enterprise.server.*; 30 31 36 37 38 public class ConnectorAdminObjectAdminServiceImpl extends 39 ConnectorServiceImpl implements ConnectorAdminService { 40 41 42 public ConnectorAdminObjectAdminServiceImpl() { 43 super(); 44 } 45 46 public void addAdminObject ( 47 String appName, 48 String connectorName, 49 String jndiName, 50 String adminObjectType, 51 Properties props) 52 throws ConnectorRuntimeException 53 { 54 ActiveResourceAdapter ar = 55 _registry.getActiveResourceAdapter(connectorName); 56 if(ar == null) { 57 ifSystemRarLoad(connectorName); 58 ar = _registry.getActiveResourceAdapter(connectorName); 59 } 60 if (ar instanceof ActiveInboundResourceAdapter) { 61 ActiveInboundResourceAdapter air = 62 (ActiveInboundResourceAdapter) ar; 63 air.addAdminObject(appName,connectorName,jndiName, 64 adminObjectType, props); 65 } else { 66 ConnectorRuntimeException cre = new ConnectorRuntimeException( 67 "This adapter is not 1.5 compliant"); 68 _logger.log(Level.SEVERE, 69 "rardeployment.non_1.5_compliant_rar",jndiName); 70 throw cre; 71 } 72 } 73 74 public void deleteAdminObject(String jndiName) 75 throws ConnectorRuntimeException 76 { 77 78 try { 79 InitialContext ic = new InitialContext(); 80 ic.unbind(jndiName); 81 } 82 catch(NamingException ne) { 83 ResourcesUtil resutil = ResourcesUtil.getInstance(); 84 if(resutil.adminObjectBelongsToSystemRar(jndiName)) { 85 return; 86 } 87 if(ne instanceof NameNotFoundException){ 88 _logger.log(Level.FINE, 89 "rardeployment.admin_object_delete_failure",jndiName); 90 _logger.log(Level.FINE,"", ne); 91 return; 92 } 93 ConnectorRuntimeException cre = new ConnectorRuntimeException( 94 "Failed to delete admin object from jndi"); 95 cre.initCause(ne); 96 _logger.log(Level.SEVERE, 97 "rardeployment.admin_object_delete_failure",jndiName); 98 _logger.log(Level.SEVERE,"", cre); 99 throw cre; 100 } 101 } 102 } 103 | Popular Tags |