1 23 24 package com.sun.enterprise.server; 25 26 import com.sun.enterprise.config.*; 27 import com.sun.enterprise.config.ConfigException; 28 import java.util.logging.Level ; 29 import java.util.logging.Logger ; 30 import java.util.*; 31 32 import com.sun.logging.LogDomains; 33 import com.sun.enterprise.connectors.*; 34 import com.sun.enterprise.deployment.*; 35 import com.sun.enterprise.util.io.FileUtils; 36 37 42 43 public class ConnectorResourcesLoader extends ResourcesLoader{ 44 45 static Logger _logger = LogDomains.getLogger(LogDomains.CORE_LOGGER); 46 47 48 49 50 public ConnectorResourcesLoader(ServerContext sc) throws ConfigException{ 51 super(sc); 52 } 53 54 55 56 public void load() { 57 ConfigBean[][] cb = null; 58 try { 59 cb = resourceUtil.getConnectorResources(); 60 if(cb != null) 61 load(cb); 62 } 63 catch(ConfigException ce) { 64 _logger.log(Level.SEVERE,"core.connectorresource_read_error" ); 65 _logger.log(Level.SEVERE,"" ,ce); 66 } 67 } 68 69 public void load(boolean standAloneRarsOnly) { 70 ConfigBean[][] cb = null; 71 try { 72 if(standAloneRarsOnly) { 73 cb = resourceUtil.getStandAloneNonSystemRarConnectorResources(); 74 } else { 75 cb = resourceUtil.getConnectorResources(standAloneRarsOnly); 76 } 77 if(cb != null) 78 load(cb); 79 } 80 catch(ConfigException ce) { 81 _logger.log(Level.SEVERE,"core.connectorresource_read_error" ); 82 _logger.log(Level.SEVERE,"" ,ce); 83 } 84 } 85 86 public void loadRAConfigs() { 87 ConfigBean[][] cb = new ConfigBean[1][];; 88 try { 89 ConfigBean[] raConfBeans = resourceUtil.getResourceAdapterConfigs(); 90 if(raConfBeans != null) { 91 cb[0] = raConfBeans; 92 load(cb); 93 } 94 } 95 catch(ConfigException ce) { 96 _logger.log(Level.SEVERE,"core.connectorresource_read_error" ); 97 _logger.log(Level.SEVERE,"" ,ce); 98 } 99 } 100 101 public void load(String rarName) { 102 103 ConfigBean[][] cb = null; 104 try { 105 cb = resourceUtil.getConnectorResources(rarName); 106 if(cb != null) 107 load(cb); 108 } 109 catch(ConfigException ce) { 110 _logger.log(Level.SEVERE,"core.connectorresource_read_error" ); 111 _logger.log(Level.SEVERE,"" ,ce); 112 113 } 114 } 115 public void loadRAConfigs(String rarName) { 116 ConfigBean[][] cb = new ConfigBean[1][];; 117 try { 118 ConfigBean[] raConfBeans = resourceUtil.getResourceAdapterConfigs(rarName); 119 if(raConfBeans != null) { 120 cb[0] = raConfBeans; 121 load(cb); 122 } 123 } 124 catch(ConfigException ce) { 125 _logger.log(Level.SEVERE,"core.connectorresource_read_error" ); 126 _logger.log(Level.SEVERE,"" ,ce); 127 } 128 } 129 130 public void loadEmbeddedRarRAConfigs(String appName) { 131 ConfigBean[][] cb = new ConfigBean[1][];; 132 try { 133 ConfigBean[] raConfBeans = 134 resourceUtil.getEmbeddedRarResourceAdapterConfigs(appName); 135 if(raConfBeans != null) { 136 cb[0] = raConfBeans; 137 load(cb); 138 } 139 } 140 catch(ConfigException ce) { 141 _logger.log(Level.SEVERE,"core.connectorresource_read_error" ); 142 _logger.log(Level.SEVERE,"" ,ce); 143 } 144 } 145 146 public void loadEmbeddedRarResources(String appName, Application appDesc) { 147 148 Set rars = appDesc.getRarDescriptors(); 149 150 for (Iterator itr = rars.iterator(); itr.hasNext();) { 151 ConnectorDescriptor cd = (ConnectorDescriptor) itr.next(); 152 String rarName = cd.getDeployName(); 153 String embeddedRarName = appName+ 154 ConnectorConstants.EMBEDDEDRAR_NAME_DELIMITER+ 155 FileUtils.makeFriendlyFilenameNoExtension(rarName); 156 load(embeddedRarName); 157 } 158 } 159 160 public void stopActiveResourceAdapters(){ 161 ConnectorRuntime.stopAllActiveResourceAdapters(); 162 } 163 164 } | Popular Tags |