/ojc-core/bpelmonitortool/monitor-src/src/com/sun/em/connectors/Connector.java

https://bitbucket.org/ssteinmetz/openesb-components · Java · 733 lines · 352 code · 112 blank · 269 comment · 0 complexity · f341142aeffe0fd5e0980e553b5404dd MD5 · raw file

  1. /* *************************************************************************
  2. *
  3. * Copyright (c) 2002, SeeBeyond Technology Corporation,
  4. * All Rights Reserved
  5. *
  6. * This program, and all the routines referenced herein,
  7. * are the proprietary properties and trade secrets of
  8. * SEEBEYOND TECHNOLOGY CORPORATION.
  9. *
  10. * Except as provided for by license agreement, this
  11. * program shall not be duplicated, used, or disclosed
  12. * without written consent signed by an officer of
  13. * SEEBEYOND TECHNOLOGY CORPORATION.
  14. *
  15. ***************************************************************************/
  16. package com.sun.em.connectors;
  17. import javax.management.Attribute;
  18. import javax.management.AttributeList;
  19. import javax.management.AttributeNotFoundException;
  20. import javax.management.InstanceAlreadyExistsException;
  21. import javax.management.InstanceNotFoundException;
  22. import javax.management.IntrospectionException;
  23. import javax.management.InvalidAttributeValueException;
  24. import javax.management.ListenerNotFoundException;
  25. import javax.management.MBeanException;
  26. import javax.management.MBeanInfo;
  27. import javax.management.MBeanRegistrationException;
  28. import javax.management.NotCompliantMBeanException;
  29. import javax.management.NotificationFilter;
  30. import javax.management.NotificationListener;
  31. import javax.management.ObjectInstance;
  32. import javax.management.ObjectName;
  33. import javax.management.QueryExp;
  34. import javax.management.MBeanServerConnection;
  35. import javax.management.ReflectionException;
  36. import javax.management.j2ee.Management;
  37. import java.io.IOException;
  38. import java.util.Properties;
  39. import java.util.Set;
  40. /**
  41. *
  42. * @author Yoke Lee
  43. */
  44. public abstract class Connector implements AbstractConnector {
  45. protected String protocol;
  46. protected String hostname;
  47. protected String port;
  48. protected String username;
  49. protected String password; // encrypted or clear-text ??
  50. protected String jndiName;
  51. protected Management mgmtConnector;
  52. protected MBeanServerConnection mbeanServerConnector;
  53. private int mHostType;
  54. /**
  55. * Connector based
  56. * @param hostname - name of the remote host
  57. * @param port - port of the host remote host
  58. * @param username -
  59. * @param password -
  60. */
  61. public Connector(String _hostname, String _port, String _username, String _password, int hostType) {
  62. this(null,_hostname,_port,_username,_password,null,hostType);
  63. }
  64. public Connector(String _hostname, String _port, String _username, String _password, String _jndiName,
  65. int hostType) {
  66. this(null,_hostname,_port,_username,_password,_jndiName,hostType);
  67. }
  68. public Connector(String _protocol, String _hostname, String _port, String _username, String _password,
  69. String _jndiName,int _hostType) {
  70. protocol = _protocol;
  71. hostname = _hostname;
  72. port = _port;
  73. username = _username;
  74. password = _password;
  75. jndiName = _jndiName;
  76. mHostType = _hostType;
  77. }
  78. /**
  79. * subclass need to implement this method
  80. *
  81. * @throws Exception
  82. */
  83. public abstract AbstractConnector getConnector() throws Exception;
  84. /**
  85. * subclass need t implement this method
  86. */
  87. public abstract AbstractConnector getConnector(Properties env) throws Exception;
  88. public Management getManagement() {
  89. return mgmtConnector;
  90. }
  91. public MBeanServerConnection getMBeanServerConnection() {
  92. return mbeanServerConnector;
  93. }
  94. public String getProtocol() {
  95. return protocol;
  96. }
  97. public String getHostName() {
  98. return hostname;
  99. }
  100. public String getPort() {
  101. return port;
  102. }
  103. public String getUserName() {
  104. return username;
  105. }
  106. public String getUserPassword() {
  107. return password;
  108. }
  109. public String getJndiName() {
  110. return jndiName;
  111. }
  112. // Public --------------------------------------------------------
  113. /**
  114. * @todo Document this method
  115. *
  116. * @param pClassName X
  117. * @param pName X
  118. * @return X
  119. * @exception ReflectionException X
  120. * @exception InstanceAlreadyExistsException X
  121. * @exception MBeanRegistrationException X
  122. * @exception MBeanException X
  123. * @exception NotCompliantMBeanException X
  124. */
  125. public ObjectInstance createMBean(
  126. String className,
  127. ObjectName objectName
  128. )
  129. throws
  130. ReflectionException,
  131. InstanceAlreadyExistsException,
  132. MBeanRegistrationException,
  133. MBeanException,
  134. NotCompliantMBeanException,
  135. java.io.IOException,
  136. java.rmi.RemoteException {
  137. throw new MBeanException(new Exception("createMBean method is not supported !!"));
  138. }
  139. /**
  140. * @todo Document this method
  141. *
  142. * @param className X
  143. * @param objectName X
  144. * @param loaderName X
  145. * @return X
  146. * @exception ReflectionException X
  147. * @exception InstanceAlreadyExistsException X
  148. * @exception MBeanRegistrationException X
  149. * @exception MBeanException X
  150. * @exception NotCompliantMBeanException X
  151. * @exception InstanceNotFoundException X
  152. */
  153. public ObjectInstance createMBean(
  154. String className,
  155. ObjectName objectName,
  156. ObjectName loaderName
  157. )
  158. throws
  159. ReflectionException,
  160. InstanceAlreadyExistsException,
  161. MBeanRegistrationException,
  162. MBeanException,
  163. NotCompliantMBeanException,
  164. InstanceNotFoundException,
  165. java.io.IOException,
  166. java.rmi.RemoteException {
  167. throw new MBeanException(new Exception("createMBean method is not supported !!"));
  168. }
  169. /**
  170. * Instantiates the given class and registers it on the remote MBeanServer
  171. * and returns an Object Instance of the MBean.
  172. *
  173. * @param className Class name of the class to be loaded and instantiated
  174. * @param objectNameToAssign Object Name the new MBean should be assigned to
  175. * @param params Array of parameter passed to the creator of the class. If
  176. * one is of data type Object handler it will be replaced on the
  177. * server-side by its effective object.
  178. * @param signature Array of Class Names (full qualified) to find the right
  179. * parameter. When there is an ObjectHandler as a parameter type then
  180. * it will be replaced on the server- side by the class name of the
  181. * effective object) otherwise it will be kept.
  182. * @exception ReflectionException X
  183. * @exception InstanceAlreadyExistsException X
  184. * @exception MBeanRegistrationException X
  185. * @exception MBeanException X
  186. * @exception NotCompliantMBeanException X
  187. * @return Object Instance of the new MBean
  188. */
  189. public ObjectInstance createMBean(
  190. String className,
  191. ObjectName objectNameToAssign,
  192. Object[] params,
  193. String[] signature
  194. )
  195. throws
  196. ReflectionException,
  197. InstanceAlreadyExistsException,
  198. MBeanRegistrationException,
  199. MBeanException,
  200. NotCompliantMBeanException,
  201. java.io.IOException,
  202. java.rmi.RemoteException {
  203. throw new MBeanException(new Exception("createMBean method is not supported !!"));
  204. }
  205. /**
  206. * @todo Document this method
  207. *
  208. * @param className X
  209. * @param objectName X
  210. * @param loaderName X
  211. * @param params X
  212. * @param signature X
  213. * @return X
  214. * @exception ReflectionException X
  215. * @exception InstanceAlreadyExistsException X
  216. * @exception MBeanRegistrationException X
  217. * @exception MBeanException X
  218. * @exception NotCompliantMBeanException X
  219. * @exception InstanceNotFoundException X
  220. */
  221. public ObjectInstance createMBean(
  222. String className,
  223. ObjectName objectName,
  224. ObjectName loaderName,
  225. Object[] params,
  226. String[] signature
  227. )
  228. throws
  229. ReflectionException,
  230. InstanceAlreadyExistsException,
  231. MBeanRegistrationException,
  232. MBeanException,
  233. NotCompliantMBeanException,
  234. InstanceNotFoundException,
  235. java.io.IOException,
  236. java.rmi.RemoteException {
  237. throw new MBeanException(new Exception("createMBean method is not supported !!"));
  238. }
  239. /**
  240. * @todo Document this method
  241. *
  242. * @param objectName X
  243. * @exception InstanceNotFoundException X
  244. * @exception MBeanRegistrationException X
  245. */
  246. public void unregisterMBean(
  247. ObjectName objectName
  248. )
  249. throws
  250. IOException,
  251. InstanceNotFoundException,
  252. MBeanRegistrationException,
  253. java.rmi.RemoteException {
  254. throw new MBeanRegistrationException(new Exception("unregisterMBean method is not supported !!"));
  255. }
  256. /**
  257. * @todo Document: Getter for ObjectInstance attribute of the
  258. * RemoteMBeanServer object
  259. *
  260. * @param objectName X
  261. * @return X
  262. * @exception InstanceNotFoundException X
  263. */
  264. public ObjectInstance getObjectInstance(
  265. ObjectName objectName
  266. )
  267. throws
  268. IOException,
  269. InstanceNotFoundException,
  270. java.rmi.RemoteException {
  271. throw new InstanceNotFoundException("getObjectInstance method is not supported !!");
  272. }
  273. /**
  274. * @todo Document this method
  275. *
  276. * @param objectName X
  277. * @param pQuery X
  278. * @return X
  279. */
  280. public Set queryMBeans(
  281. ObjectName objectName,
  282. QueryExp pQuery
  283. ) throws IOException,
  284. java.rmi.RemoteException {
  285. throw new IOException("queryMBeans method is not supported !!");
  286. }
  287. /**
  288. * @todo Document this method
  289. *
  290. * @param objectName X
  291. * @param pQuery X
  292. * @return X
  293. */
  294. public Set queryNames(
  295. ObjectName objectName,
  296. QueryExp pQuery
  297. ) throws IOException,
  298. java.rmi.RemoteException {
  299. return null;
  300. }
  301. /**
  302. * @todo Document: Getter for Registered attribute of the RemoteMBeanServer
  303. * object
  304. *
  305. * @param objectName X
  306. * @return X
  307. */
  308. public boolean isRegistered(
  309. ObjectName objectName
  310. ) throws IOException,
  311. java.rmi.RemoteException {
  312. return false;
  313. }
  314. /**
  315. * @todo Document: Getter for InstanceOf attribute of the RemoteMBeanServer
  316. * object
  317. *
  318. * @param objectName X
  319. * @param className X
  320. * @return X
  321. * @exception InstanceNotFoundException X
  322. */
  323. public boolean isInstanceOf(
  324. ObjectName objectName,
  325. String className
  326. )
  327. throws
  328. IOException,
  329. InstanceNotFoundException,
  330. java.rmi.RemoteException {
  331. throw new InstanceNotFoundException("isInstanceOf method is not supported !!");
  332. }
  333. /**
  334. * @todo Document: Getter for MBeanCount attribute of the RemoteMBeanServer
  335. * object
  336. * @return X
  337. */
  338. public Integer getMBeanCount(
  339. ) throws IOException,
  340. java.rmi.RemoteException {
  341. return null;
  342. }
  343. /**
  344. * @todo Document: Getter for Attribute attribute of the RemoteMBeanServer
  345. * object
  346. *
  347. * @param objectName X
  348. * @param pAttribute X
  349. * @return X
  350. * @exception MBeanException X
  351. * @exception AttributeNotFoundException X
  352. * @exception InstanceNotFoundException X
  353. * @exception ReflectionException X
  354. */
  355. public Object getAttribute(
  356. ObjectName objectName,
  357. String pAttribute
  358. )
  359. throws
  360. IOException,
  361. MBeanException,
  362. AttributeNotFoundException,
  363. InstanceNotFoundException,
  364. ReflectionException,
  365. java.rmi.RemoteException {
  366. return null;
  367. }
  368. /**
  369. * @todo Document: Getter for Attributes attribute of the RemoteMBeanServer
  370. * object
  371. *
  372. * @param objectName X
  373. * @param pAttributes X
  374. * @return X
  375. * @exception InstanceNotFoundException X
  376. * @exception ReflectionException X
  377. */
  378. public AttributeList getAttributes(
  379. ObjectName objectName,
  380. String[] pAttributes
  381. )
  382. throws
  383. IOException,
  384. InstanceNotFoundException,
  385. ReflectionException,
  386. java.rmi.RemoteException {
  387. return null;
  388. }
  389. /**
  390. * @todo Document: Setter for Attribute attribute of the RemoteMBeanServer
  391. * object
  392. *
  393. * @param objectName attribute
  394. * @param pAttribute attribute
  395. * @exception InstanceNotFoundException X
  396. * @exception AttributeNotFoundException X
  397. * @exception InvalidAttributeValueException X
  398. * @exception MBeanException X
  399. * @exception ReflectionException X
  400. */
  401. public void setAttribute(
  402. ObjectName objectName,
  403. Attribute pAttribute
  404. )
  405. throws
  406. IOException,
  407. InstanceNotFoundException,
  408. AttributeNotFoundException,
  409. InvalidAttributeValueException,
  410. MBeanException,
  411. ReflectionException,
  412. java.rmi.RemoteException {
  413. }
  414. /**
  415. * @todo Document: Setter for Attributes attribute of the RemoteMBeanServer
  416. * object
  417. *
  418. * @param objectName attributes
  419. * @param pAttributes attributes
  420. * @return X
  421. * @exception InstanceNotFoundException X
  422. * @exception ReflectionException X
  423. */
  424. public AttributeList setAttributes(
  425. ObjectName objectName,
  426. AttributeList pAttributes
  427. )
  428. throws
  429. IOException,
  430. InstanceNotFoundException,
  431. ReflectionException,
  432. java.rmi.RemoteException {
  433. return null;
  434. }
  435. /**
  436. * @todo Document this method
  437. *
  438. * @param objectName X
  439. * @param actionName X
  440. * @param params X
  441. * @param signature X
  442. * @return X
  443. * @exception InstanceNotFoundException X
  444. * @exception MBeanException X
  445. * @exception ReflectionException X
  446. */
  447. public Object invoke(
  448. ObjectName objectName,
  449. String actionName,
  450. Object[] params,
  451. String[] signature
  452. )
  453. throws
  454. IOException,
  455. InstanceNotFoundException,
  456. MBeanException,
  457. ReflectionException,
  458. java.rmi.RemoteException {
  459. return null;
  460. }
  461. /**
  462. * @todo Document: Getter for DefaultDomain attribute of the
  463. * RemoteMBeanServer object
  464. * @return X
  465. */
  466. public String getDefaultDomain(
  467. ) throws
  468. IOException,
  469. java.rmi.RemoteException {
  470. return null;
  471. }
  472. public String[] getDomains() throws IOException {
  473. throw new IOException("getDomains method is not supported !!");
  474. }
  475. /**
  476. * @todo Document: Getter for MBeanInfo attribute of the RemoteMBeanServer
  477. * object
  478. *
  479. * @param objectName X
  480. * @return X
  481. * @exception InstanceNotFoundException X
  482. * @exception IntrospectionException X
  483. * @exception ReflectionException X
  484. */
  485. public MBeanInfo getMBeanInfo(
  486. ObjectName objectName
  487. )
  488. throws
  489. IOException,
  490. InstanceNotFoundException,
  491. IntrospectionException,
  492. ReflectionException,
  493. java.rmi.RemoteException {
  494. return null;
  495. }
  496. /**
  497. * Adds a feature to the NotificationListener attribute of the
  498. * RemoteMBeanServer object
  499. *
  500. * @param objectName The feature to be added to the NotificationListener
  501. * attribute
  502. * @param listener The feature to be added to the NotificationListener
  503. * attribute
  504. * @param filter The feature to be added to the NotificationListener
  505. * attribute
  506. * @param handback The feature to be added to the NotificationListener
  507. * attribute
  508. * @exception InstanceNotFoundException X
  509. */
  510. public void addNotificationListener(
  511. ObjectName objectName,
  512. NotificationListener listener,
  513. NotificationFilter filter,
  514. Object handback
  515. )
  516. throws
  517. IOException,
  518. InstanceNotFoundException,
  519. java.rmi.RemoteException {
  520. throw new InstanceNotFoundException("addNotificationListener method is not supported !!");
  521. }
  522. /**
  523. * Adds a feature to the NotificationListener attribute of the
  524. * RemoteMBeanServer object
  525. *
  526. * @param objectName The feature to be added to the NotificationListener
  527. * attribute
  528. * @param listener The feature to be added to the NotificationListener
  529. * attribute
  530. * @param filter The feature to be added to the NotificationListener
  531. * attribute
  532. * @param handback The feature to be added to the NotificationListener
  533. * attribute
  534. * @exception InstanceNotFoundException X
  535. */
  536. public void addNotificationListener(
  537. ObjectName objectName,
  538. ObjectName listener,
  539. NotificationFilter filter,
  540. Object handback
  541. )
  542. throws
  543. IOException,
  544. InstanceNotFoundException,
  545. java.rmi.RemoteException {
  546. throw new InstanceNotFoundException("addNotificationListener method is not supported !!");
  547. }
  548. /**
  549. * @todo Document this method
  550. *
  551. * @param objectName X
  552. * @param listener X
  553. * @exception InstanceNotFoundException X
  554. * @exception ListenerNotFoundException X
  555. * @exception UnsupportedOperationException X
  556. */
  557. public void removeNotificationListener(
  558. ObjectName objectName,
  559. ObjectName listener
  560. )
  561. throws
  562. IOException,
  563. InstanceNotFoundException,
  564. ListenerNotFoundException,
  565. UnsupportedOperationException,
  566. java.rmi.RemoteException {
  567. throw new InstanceNotFoundException("removeNotificationListener method is not supported !!");
  568. }
  569. /**
  570. * @todo Document this method
  571. *
  572. * @param objectName X
  573. * @param listener X
  574. * @exception InstanceNotFoundException X
  575. * @exception ListenerNotFoundException X
  576. */
  577. public void removeNotificationListener(
  578. ObjectName objectName,
  579. NotificationListener listener
  580. )
  581. throws
  582. IOException,
  583. InstanceNotFoundException,
  584. ListenerNotFoundException,
  585. java.rmi.RemoteException {
  586. throw new InstanceNotFoundException("removeNotificationListener method is not supported !!");
  587. }
  588. /**
  589. *
  590. */
  591. public void removeNotificationListener(
  592. ObjectName name,
  593. NotificationListener listener,
  594. NotificationFilter filter,
  595. Object handback)
  596. throws
  597. IOException,
  598. InstanceNotFoundException,
  599. ListenerNotFoundException,
  600. java.rmi.RemoteException {
  601. throw new InstanceNotFoundException("removeNotificationListener method is not supported !!");
  602. }
  603. /**
  604. *
  605. */
  606. public void removeNotificationListener(
  607. ObjectName name,
  608. ObjectName listener,
  609. NotificationFilter filter,
  610. Object handback)
  611. throws
  612. IOException,
  613. InstanceNotFoundException,
  614. ListenerNotFoundException,
  615. java.rmi.RemoteException {
  616. throw new InstanceNotFoundException("removeNotificationListener method is not supported !!");
  617. }
  618. public int getHostType() {
  619. return mHostType ;
  620. }
  621. }