1 19 package org.netbeans.modules.j2ee.sun.ide.controllers; 20 21 import java.util.List ; 22 import com.sun.appserv.management.client.AppserverConnectionSource; 23 import com.sun.appserv.management.config.Enabled; 24 import com.sun.appserv.management.j2ee.J2EEDeployedObject; 25 import com.sun.appserv.management.j2ee.ResourceAdapterModule; 26 import com.sun.appserv.management.j2ee.ResourceAdapter; 27 import com.sun.appserv.management.config.RARModuleConfig; 28 import javax.enterprise.deploy.spi.DeploymentManager ; 29 import org.netbeans.modules.j2ee.sun.bridge.apis.AppserverMgmtControllerBase; 30 31 import org.netbeans.modules.j2ee.sun.util.NodeTypes; 32 33 34 42 public class ConnectorModuleController extends AppserverMgmtControllerBase 43 implements DeployedItemsController, EnablerController { 44 45 private ResourceAdapterModule connectorModule; 46 private RARModuleConfig connectorConfig; 47 48 54 public ConnectorModuleController(ResourceAdapterModule connectorModule, 55 AppserverConnectionSource connection) { 56 super(connectorModule, connection); 57 this.connectorModule = connectorModule; 58 } 59 60 61 67 public ConnectorModuleController( 68 final ResourceAdapterModule connectorModule, 69 final DeploymentManager dplmtMgr, 70 final AppserverConnectionSource connection) { 71 super(connectorModule, dplmtMgr, connection); 72 this.connectorModule = connectorModule; 73 } 74 75 public ConnectorModuleController( 76 final ResourceAdapterModule connectorModule, 77 final RARModuleConfig connectorConfig, 78 final DeploymentManager dplmtMgr, 79 final AppserverConnectionSource connection) { 80 super(connectorConfig, dplmtMgr, connection); 81 this.connectorModule = connectorModule; 82 this.connectorConfig = connectorConfig; 83 } 84 85 91 public java.util.Map getProperties(List propsToIgnore) { 92 return getJ2EEAndConfigProperties(NodeTypes.CONNECTOR_MODULE, 93 connectorModule, connectorConfig, propsToIgnore); 94 } 95 96 97 105 public javax.management.Attribute setProperty(final String attrName, final Object value) { 106 107 testIfServerInDebug(); 108 109 return ControllerUtil.setAttributeValue(connectorModule, connectorConfig, attrName, value, 110 getMBeanServerConnection()); 111 } 112 113 117 public String [] getResourceAdaptors() { 118 119 testIfServerInDebug(); 120 121 return ControllerUtil.getComponentNamesFromMap( 122 connectorModule.getContaineeMap( 123 NodeTypes.getAMXJ2EETypeByNodeType(NodeTypes.RESOURCE_ADAPTER))); 124 } 125 126 127 130 public java.util.Map getResourceAdapterProperties( 131 final String resAdapterName, final List propsToIgnore) { 132 return getJ2EEAndConfigProperties(NodeTypes.RESOURCE_ADAPTER, 133 getResourceAdapterByName(resAdapterName), connectorConfig, propsToIgnore); 134 } 135 136 137 140 public javax.management.Attribute setResourceAdapterProperty( 141 final String resAdapterName, final String attrName, 142 final Object value) { 143 144 testIfServerInDebug(); 145 146 return ControllerUtil.setAttributeValue( 147 getResourceAdapterByName(resAdapterName), attrName, value, 148 getMBeanServerConnection()); 149 } 150 151 152 156 public ResourceAdapter getResourceAdapterByName(final String name) { 157 158 testIfServerInDebug(); 159 160 return (ResourceAdapter) connectorModule.getContainee( 161 NodeTypes.getAMXJ2EETypeByNodeType( 162 NodeTypes.RESOURCE_ADAPTER), name); 163 } 164 165 166 171 public boolean isEnabled() { 172 testIfServerInDebug(); 173 boolean configEnabled = ((Enabled)connectorConfig).getEnabled(); 174 return ControllerUtil.calculateIsEnabled(connectorConfig, configEnabled); 175 } 176 177 178 183 public void setEnabled(boolean enabled) { 184 testIfServerInDebug(); 185 ControllerUtil.getDeployedItemRefConfig(connectorConfig).setEnabled(enabled); 186 } 187 188 public J2EEDeployedObject getJ2EEObject() { 189 return connectorModule; 190 } 191 192 } 193 | Popular Tags |