diff options
author | Martin Ritchie <ritchiem@apache.org> | 2007-04-26 15:28:48 +0000 |
---|---|---|
committer | Martin Ritchie <ritchiem@apache.org> | 2007-04-26 15:28:48 +0000 |
commit | 967019c1bdd48d01d21d109d6187d42c341d8b43 (patch) | |
tree | ad7966e1cb44f65c89ca9f6f14d9f190f6b01945 | |
parent | cff98719781f661247e3f8f69a3adc313363e17b (diff) | |
download | qpid-python-967019c1bdd48d01d21d109d6187d42c341d8b43.tar.gz |
Merged revisions 1-447993,447995-448007,448009-448141,448143-448157,448161-448194,448196-448210,448212-448218,448220-448223,448225-448233,448235,448237-448241,448243-448596,448598-448623,448625-448850,448852-448880,448882-448982,448984-449635,449637-449639,449641-449642,449644-449645,449647-449674,449676-449719,449721-449749,449751-449762,449764-449933,449935-449941,449943-450383,450385,450387-450400,450402-450433,450435-450503,450505-450555,450557-450860,450862-451024,451026-451149,451151-451316,451318-451931,451933-452139,452141-452162,452164-452320,452322,452324-452325,452327-452333,452335-452429,452431-452528,452530-452545,452547-453192,453194-453195,453197-453536,453538,453540-453656,453658-454676,454678-454735,454737,454739-454781,454783-462728,462730-462819,462821-462833,462835-462839,462841-463071,463073-463178,463180-463308,463310-463362,463364-463375,463377-463396,463398-463402,463404-463409,463411-463661,463663-463670,463672-463673,463675-464493,464495-464502,464504-464576,464578-464613,464615-464628,464630,464632-464866,464868-464899,464901-464942,464944-464949,464951-465004,465006-465016,465018-465053,465055-465165,465167-465321,465323-465406,465408-465427,465429-465431,465433-465548,465550-466044,466047-466075,466077,466079-466081,466083-466099,466101-466112,466114-466126,466128-466240,466242-466971,466973-466978,466980-467309,467311-467312,467316-467328,467330-467485,467487-467588,467590-467604,467606-467699,467701-467706,467708-467749,467751-468069,468071-468537,468539-469241,469244-469246,469248-469318,469320-469421,469423,469425-469429,469431-469435,469437-469462,469464-469469,469472-469477,469479-469490,469492-469503,469505-469529,469531-469598,469600-469624,469626-469737,469739-469752,469754-469806,469808-469928,469930-469953,469955-470011,470013-470109,470111-470335,470338-470339,470341-470379,470381,470383-470399,470401-470446,470448-470741,470743-470758,470760-470809,470811-470817,470819-470993,470995-471001,471003-471788,471790-471792,471794-472028,472030-472032,472034-472036,472038,472040,472043,472045-472059,472061,472063,472065-472066,472068,472070-472072,472074-472080,472082,472084-472092,472094-472107,472109-472123,472125-472158,472160-472165,472167-472172,472174-472457,472459-472460,472462-472464,472466-472470,472472-472483,472486-472491,472493-472494,472496-472497,472499,472501-472503,472505-472512,472514-472544,472546-472556,472558-472560,472562-472572,472574-472587,472589-472591,472593-472605,472607,472609-472731,472733-472786,472788-472843,472845-472849,472851-472859,472861-472878,472880-472903,472905,472907-472988,472990-472991,472993-473071,473073-473086,473088-473090,473093,473095-473096,473098-473106,473108-473110,473112-473185,473187-473260,473262,473268-473270,473275-473279,473281,473284-473287,473289-473295,473297-473306,473308-473330,473332-473335,473337,473339-473344,473346-473351,473353-473355,473357-473358,473361-473471,473473-473497,473499-473535,473537-473567,473569-473888,473890-474451,474454-474492,474494-474563,474565-474843,474845-474865,474867-474932,474934-475035,475037-475144,475146-475180,475182-475265,475267-475285,475287,475289-475293,475295-475296,475298-475302,475304-475631,475633-475649,475651-475748,475750-475752,475754-476107,476109-476302,476304-476413,476415-476430,476432-476700,476702-476868,476870-477147,477149-477213,477215-477263,477265-477340,477342-477635,477637-477789,477791-477825,477827-477841,477843,477846-477852,477854,477856,477858-477865,477867-477894,477896-478022,478024-478182,478184-478211,478213-478233,478235-478236,478238-478241,478243-478252,478254-478259,478261-478263,478265,478267-478269,478271-478286,478288-478342,478344-478379,478381-478412,478414-478443,478445-478636,478639-478658,478660-478821,478823-478853,478855-478922,478924-478962,478965-478974,478976-479029,479031-479049,479051-479210,479212-479214,479216-479407,479409-479415,479417-479425,479427-479559,479561-479639,479641-479676,479678-479685,479687-480030,480033-480086,480091-480093,480095-480118,480120-480139,480141,480143-480148,480150-480156,480158-480163,480165-480177,480179-480189,480191-480193,480195-480198,480200-480220,480222-480282,480284-480292,480294-480308,480310-480317,480320-480422,480424,480426-480581,480583-480656,480658-480692,480695-480702,480704,480706-480710,480712-480910,480913-480933,480935-480945,480947-480972,480974-480993,480995-481034,481036-481158,481161-481174,481176-481220,481222-481234,481236-481260,481263-481264,481266-481296,481298-481304,481306-481311,481313-481332,481334,481336-481380,481382-481441,481443-482144,482146-482180,482182-482193,482195-482232,482234-482236,482239,482241-482242,482244-482247,482250-482251,482253,482256-482261,482264-482288,482290-482364,482366,482368,482370-482554,482556,482558-482569,482572-482636,482638,482640-482696,482698-482722,482724-482732,482734-482771,482774-482957,482959-483045,483047-483105,483108,483110-483115,483117,483119-483127,483130-483134,483136-483148,483150-483158,483160-483164,483166-483178,483180-483391,483393-483400,483402-483403,483405-483418,483420-483421,483425-483436,483438-483470,483472-483502,483504-483558,483560-483599,483601-483637,483639-483644,483646-483659,483661-483670,483672-483878,483880-483910,483912-483915,483917-483940,483942,483944-483968,483970-483972,483974-483976,483978,483980-484612,484614-484657,484659-484693,484695-484718,484720-484842,484844-484847,484849-484986,484988-485019,485021-485489,485491-485544,485546-485591,485593,485595-485697,485699-485729,485731-485734,485736-485779,485781-485787,485789-485851,485853,485855-486007,486009,486011-486020,486022-486083,486085-486097,486099-486117,486120-486131,486133-486148,486150-486161,486163-486164,486166-486197,486199-486205,486208-486247,486249-486253,486256-486427,486429-486431,486433-486554,486556-486573,486575-486593,486595,486597-486609,486611-486619,486622,486625,486627-486641,486643-486645,486649-486687,486689-486721,486723-486730,486732-486746,486748-486759,486761,486763-486777,486779-486782,486784-486788,486790,486792,486794-486796,486798-487175,487178,487180-487213,487215,487217-487267,487269-487284,487286-487298,487300-487358,487360-487367,487369-487382,487384-487434,487436-487480,487482-487547,487549-487561,487563-487565,487567-487578,487580-487615,487617-487622,487624,487626,487628,487630-487635,487637-487703,487705-487777,487780-487781,487783-487800,487802-487803,487805-487820,487822-487848,487850-487902,487904-488103,488105-488133,488135-488158,488160-488163,488165-488187,488189-488216,488218-488248,488250-488278,488280,488282-488303,488305-488313,488315-488342,488344-488351,488353-488376,488378-488449,488451-488593,488595,488597-488623,488625-488700,488702-488704,488706-488710,488714,488716-488725,488727-488744,488746-488770,488772-488798,488800,488802-488807,488809,488811-488829,488831-488843,488845-488851,488853-489069,489071-489077,489079-489081,489084-489102,489104-489105,489107-489109,489111-489112,489114-489139,489141-489178,489181-489203,489205-489211,489213,489216-489329,489332-489402,489404-489417,489419-489421,489423-489643,489645-489690,489692-489703,489705-489714,489716-489747,489749-489753,489755-489803,489805-489904,489906-490372,490374-490504,490506-490604,490606-490707,490710-490733,490735-490871,490873-490984,490986-491028,491030,491032-491071,491073-491119,491121-491576,491578-491672,491674-491800,491802-491838,491840-491878,491880-492183,492185-492279,492281-492317,492319-492513,492515-492584,492586-492587,492589-492601,492603-492635,492637-492640,492642-492717,492719-492723,492725-492729,492731-492755,492757-492901,492903-492955,492957-492962,492964-492997,492999-493002,493004-493041,493043-493059,493062-493063,493065-493086,493088-493125,493127-493139,493141-493150,493152-493871,493873-494017,494019-494030,494032-494041,494043-494091,494093-494120,494122-494354,494356-494436,494438-494539,494541-494552,494554-494586,494588-494649,494651,494653-494654,494656-494657,494659-494764,494766-494768,494770-494796,494798-494799,494802,494804-494860,494862-494903,494905-494906,494908-495019,495021-495160,495162-495168,495171-495188,495190-495229,495231-495254,495256-495303,495305-495313,495315-495336,495338-495372,495374-495379,495381-495454,495457-495459,495462-495516,495518-495524,495526-495531,495533-495548,495551-495553,495555,495557-495558,495560,495562-495573,495575-495583,495585-495594,495596-495628,495630-495638,495640-495651,495653-495660,495662-495753,495755-496259,496261-496262,496264-496269,496271-496275,496277-496301,496303-496316,496318-496383,496385-496413,496415-496495,496497-496625,496627-496636,496638-496640,496642-496647,496650-496657,496659-496660,496663-496664,496666-496677,496679-496681,496683-496730,496732-496750,496752,496754-496784,496786-496832,496834-496840,496842-496990,496992-496995,496997-497340,497343-497351,497353-497403,497405-497424,497426-497438,497440-497481,497483-497497,497499-497765,497767-497769,497771-497775,497777-497778,497780,497782-497783,497785,497787-497812,497814-497871,497873-497877,497879-498573,498575-498588,498590,498592,498594-498636,498638-498669,498671-498686,498688-498689,498691-498719,498721-498964,498966-498969,498971-498973,498975-498982,498985-499035,499037-499040,499042,499044-499048,499050-499082,499084-499086,499088-499164,499167-499169,499171-499355,499357-499370,499372-499373,499375-499391,499393,499395-499425,499428,499430-499445,499447-499455,499457-499460,499462-499465,499467,499469-499489,499491-499492,499494-499531,499533-499562,499566-499627,499629-499715,499717-499732,499734-499755,499758-499763,499765-499780,499782-499795,499797-499802,499804-499844,499846,499848-499850,499852-499863,499865-499873,499875-499974,499976-499978,499980-500263,500265-500283,500285-500309,500311-501000,501002,501012-501057,501059-501095,501097-501390,501392-501410,501413-501447,501449-501454,501456,501458-501464,501466-501471,501473-501803,501805-501913,501915-501916,501918-501919,501921-501944,501946-502171,502173-502177,502181,502183-502247,502250-502252,502254-502260,502262-502267,502270,502272,502274-502575,502577-502609,502611-502619,502621-502626,502628-502654,502656-503592,503594-503603,503605-503608,503610-503636,503638-503645,503647-503705,503707-503789,503791-504024,504026-504111,504113-504506,504508-504735,504737-504863,504865-504867,504869-504914,504916-505241,505243-505254,505257-505267,505269-505354,505356-505891,505893-505971,505973-506400,506402-506404,506407-506438,506440-506516,506518-506541,506543-506966,506968-506971,506973-507095,507097-507108,507111-507454,507456,507459-507471,507473-507556,507558,507560-507581,507585-507594,507597,507599-507608,507610-507728,507730-507893,507895-507937,507940-508234,508236-508350,508352-508365,508367-508380,508383,508386-508415,508417-508648,508650-508941,508943-509146,509148-509171,509173-509175,509179-509201,509203-509207,509209-509215,509217-509222,509224-509477,509480-509627,509629-509634,509636-509641,509643-509736,509738-509931,509933-510059,510061-510075,510077-510158,510161-510896,510898-510938,510940-511388,511390-511922,511924-512287,512289-512698,512702-512813,512815-512817,512819-513359,513361-513370,513372-514702,514704-514886,514888-514902,514904-515126,515129-515141,515143-515516,515518-515534,515536-515538,515540-515648,515650-515651,515653-516070,516072-516411,516413-516448,516450,516452-517637,517639-517647,517649-517659,517661-517663,517665-517677,517679-517682,517684-517744,517746-518085,518087-518175,518177-518558,518560-518568,518571-518666,518668,518670-518699,518701-518987,518990-518992,518994-519908,519910-519932,519934-520414,520416-520842,520844-520937,520939-521362,521364-521681,521683-521704,521706-521709,521711-521714,521716-521781,521783-521792,521794-522462,522464-522527,522529-522534,522536-522566,522568-522958,522960,522962-522966,522968-522976,522978-522980,522982-522988,522992-522993,522995-523244,523246-523746,523748-524049,524051-524738,524741-524742,524744-524762,524764,524766,524768-525486,525488-525530,525532,525534,525537-525552,525554-525765,525767-525776,525778-525784,525789-525803,525805-525816,525818-525828,525830-525861,525863-525866,525868-526090,526092-526112,526114-526116,526119-526121,526123-526149,526151-526153,526155-526156,526160-526165,526167-526186,526188-526193,526196-526197,526200-526665,526667-526682,526686-526690,526693,526695-526708,526710-526713,526715-526775,526777-526802,526804-526806,526808-527048,527051-527052,527054-527181,527183-527486,527488-527492,527494-527498,527500-527508,527510-527517,527519-527536,527538-527555,527559-527802,527804-527842,527844-527847,527849-527875,527877-527940,527942-527958,527960-527971,527973-528002,528004,528006-528423,528425-529232,529234-529245,529247-529296,529298-529634,529636-529658,529660-529665,529667-529668,529670-530033,530035-530036,530038-530040,530045-530046,530050-530051,530053-530431,530433-530436,530439-530440,530443,530445-530446,530448,530450-530682,530684,530687-530696,530698-530733,530735-530776,530778-530795,530799,530801-530811,530813-530818,530820-530837,530839-531436,531438-531455,531457,531459-531511,531514,531516,531519-531523,531525,531528-532465,532467-532764 via svnmerge from
https://svn.apache.org/repos/asf/incubator/qpid/branches/M2
........
r531859 | ritchiem | 2007-04-24 11:06:41 +0100 (Tue, 24 Apr 2007) | 1 line
Defaulted the use of JMX SASL security to false. As this requries the jmxremote.jar from sun which is not Apache license friendly.
........
r531865 | ritchiem | 2007-04-24 11:24:51 +0100 (Tue, 24 Apr 2007) | 1 line
Defaulted the use of management.security-enabled security to false. As this requires the jmxremote.jar from sun which is not Apache license friendly.
........
r531908 | bhupendrab | 2007-04-24 13:38:18 +0100 (Tue, 24 Apr 2007) | 1 line
Management Console sasl changes
........
r531917 | bhupendrab | 2007-04-24 14:03:55 +0100 (Tue, 24 Apr 2007) | 1 line
Added display of build and release versions in Help->About
........
r531937 | ritchiem | 2007-04-24 14:42:03 +0100 (Tue, 24 Apr 2007) | 1 line
Reduced logging on requeue.
........
r531989 | bhupendrab | 2007-04-24 16:49:03 +0100 (Tue, 24 Apr 2007) | 1 line
Added connection exception handling and refactored the action classes
........
r532002 | bhupendrab | 2007-04-24 17:35:43 +0100 (Tue, 24 Apr 2007) | 1 line
Management Console SASL changes
........
r532372 | bhupendrab | 2007-04-25 15:46:03 +0100 (Wed, 25 Apr 2007) | 1 line
Made the return type of getTestMessage() to a generic type for subclass to override.
........
r532728 | ritchiem | 2007-04-26 13:38:41 +0100 (Thu, 26 Apr 2007) | 3 lines
QPID-292 - Authentication not handled correctly.
Copied handling from SecureOkMethod handler.
........
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@532779 13f79535-47bb-0310-9956-ffa450edef68
29 files changed, 344 insertions, 332 deletions
diff --git a/java/broker/etc/config.xml b/java/broker/etc/config.xml index c66c2f632e..b5b81bbeb0 100644 --- a/java/broker/etc/config.xml +++ b/java/broker/etc/config.xml @@ -42,7 +42,7 @@ <management> <enabled>true</enabled> <jmxport>8999</jmxport> - <security-enabled>true</security-enabled> + <security-enabled>false</security-enabled> </management> <advanced> <filterchain enableExecutorPool="true"/> diff --git a/java/broker/src/main/java/org/apache/qpid/server/AMQChannel.java b/java/broker/src/main/java/org/apache/qpid/server/AMQChannel.java index 97c95dae5e..918b5fc176 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/AMQChannel.java +++ b/java/broker/src/main/java/org/apache/qpid/server/AMQChannel.java @@ -431,24 +431,20 @@ public class AMQChannel */ public void requeue() throws AMQException { - if (_log.isInfoEnabled()) - { - _log.info("Requeuing for " + toString()); - } - // we must create a new map since all the messages will get a new delivery tag when they are redelivered Collection<UnacknowledgedMessage> messagesToBeDelivered = _unacknowledgedMessageMap.cancelAllMessages(); - if (_log.isDebugEnabled()) - { - _log.info("Requeuing " + messagesToBeDelivered.size() + " unacked messages."); - } // Deliver these messages out of the transaction as their delivery was never // part of the transaction only the receive. TransactionalContext deliveryContext = null; if (!messagesToBeDelivered.isEmpty()) { + if (_log.isInfoEnabled()) + { + _log.info("Requeuing " + messagesToBeDelivered.size() + " unacked messages. for " + toString()); + } + if (!(_txnContext instanceof NonTransactionalContext)) { // if (_nonTransactedContext == null) diff --git a/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionStartOkMethodHandler.java b/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionStartOkMethodHandler.java index 4734143497..29d6c26b66 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionStartOkMethodHandler.java +++ b/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionStartOkMethodHandler.java @@ -30,6 +30,7 @@ import org.apache.qpid.framing.AMQFrame; import org.apache.qpid.framing.ConnectionSecureBody; import org.apache.qpid.framing.ConnectionStartOkBody; import org.apache.qpid.framing.ConnectionTuneBody; +import org.apache.qpid.framing.ConnectionCloseBody; import org.apache.qpid.protocol.AMQMethodEvent; import org.apache.qpid.protocol.AMQConstant; import org.apache.qpid.server.protocol.AMQProtocolSession; @@ -93,10 +94,24 @@ public class ConnectionStartOkMethodHandler implements StateAwareMethodListener< switch (authResult.status) { case ERROR: - throw new AMQException("Authentication failed"); + _logger.info("Authentication failed"); + stateManager.changeState(AMQState.CONNECTION_CLOSING); + // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0) + // TODO: Connect this to the session version obtained from ProtocolInitiation for this session. + // Be aware of possible changes to parameter order as versions change. + AMQFrame close = ConnectionCloseBody.createAMQFrame(0, + (byte) 8, (byte) 0, // AMQP version (major, minor) + ConnectionCloseBody.getClazz((byte) 8, (byte) 0), // classId + ConnectionCloseBody.getMethod((byte) 8, (byte) 0), // methodId + AMQConstant.NOT_ALLOWED.getCode(), // replyCode + AMQConstant.NOT_ALLOWED.getName()); // replyText + session.writeFrame(close); + disposeSaslServer(session); + break; + case SUCCESS: _logger.info("Connected as: " + ss.getAuthorizationID()); - session.setAuthorizedID(new UsernamePrincipal(ss.getAuthorizationID())); + session.setAuthorizedID(new UsernamePrincipal(ss.getAuthorizationID())); stateManager.changeState(AMQState.CONNECTION_NOT_TUNED); // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0) diff --git a/java/broker/src/main/java/org/apache/qpid/server/management/JMXManagedObjectRegistry.java b/java/broker/src/main/java/org/apache/qpid/server/management/JMXManagedObjectRegistry.java index a14d4214e3..f277398b50 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/management/JMXManagedObjectRegistry.java +++ b/java/broker/src/main/java/org/apache/qpid/server/management/JMXManagedObjectRegistry.java @@ -94,7 +94,7 @@ public class JMXManagedObjectRegistry implements ManagedObjectRegistry IApplicationRegistry appRegistry = ApplicationRegistry.getInstance(); - boolean security = appRegistry.getConfiguration().getBoolean("management.security-enabled", true); + boolean security = appRegistry.getConfiguration().getBoolean("management.security-enabled", false); int port = appRegistry.getConfiguration().getInt("management.jmxport", 8999); if (security) diff --git a/java/distribution/src/main/assembly/management-eclipse-plugin.xml b/java/distribution/src/main/assembly/management-eclipse-plugin.xml index 98534d43d0..826128b42f 100644 --- a/java/distribution/src/main/assembly/management-eclipse-plugin.xml +++ b/java/distribution/src/main/assembly/management-eclipse-plugin.xml @@ -90,7 +90,7 @@ </fileSet> <fileSet> <directory>../management/eclipse-plugin/src/main/resources/sasl</directory> - <outputDirectory>qpidmc/eclipse/plugins/jmxremote.optional_1.0.1/META-INF</outputDirectory> + <outputDirectory>qpidmc/eclipse/plugins/jmxremote.sasl_1.0.1/META-INF</outputDirectory> <includes> <include>MANIFEST.MF</include> </includes> diff --git a/java/management/eclipse-plugin/META-INF/MANIFEST.MF b/java/management/eclipse-plugin/META-INF/MANIFEST.MF index a92f375886..a03c35c457 100644 --- a/java/management/eclipse-plugin/META-INF/MANIFEST.MF +++ b/java/management/eclipse-plugin/META-INF/MANIFEST.MF @@ -8,6 +8,6 @@ Bundle-Localization: plugin Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime, org.eclipse.ui.forms, - jmxremote.optional + jmxremote.sasl Eclipse-LazyStart: true Bundle-Vendor: Apache Software Foundation diff --git a/java/management/eclipse-plugin/plugin.xml b/java/management/eclipse-plugin/plugin.xml index bd7ae0a474..5774859b47 100644 --- a/java/management/eclipse-plugin/plugin.xml +++ b/java/management/eclipse-plugin/plugin.xml @@ -96,6 +96,11 @@ description="pops up the window for editing selected attribute" id="org.apache.qpid.management.ui.actions.cmd_editAttribute" name="Edit Attribute"/> + <command + categoryId="org.apache.qpid.management.ui.category" + description="About Qpid Management Console" + id="qpidmc.about" + name="About"/> </extension> <extension point="org.eclipse.ui.bindings"> @@ -139,16 +144,12 @@ application="org.apache.qpid.management.ui.application" name="Qpid Management Console"> <property - name="about Qpid Management Console" - value="version 0.1.0"> - </property> - <property name="windowImages" value="icons/qpidmc16.gif,icons/qpidmc32.gif"> </property> <property name="aboutText" - value="Qpid Management Console
version 0.1.0"/> + value="Qpid Management Console"/> </product> </extension> <extension diff --git a/java/management/eclipse-plugin/pom.xml b/java/management/eclipse-plugin/pom.xml index c61adde877..152b5e9b1a 100644 --- a/java/management/eclipse-plugin/pom.xml +++ b/java/management/eclipse-plugin/pom.xml @@ -207,6 +207,10 @@ <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-antrun-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <configuration> <archive> diff --git a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ApplicationActionBarAdvisor.java b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ApplicationActionBarAdvisor.java index 9015b74f3f..b5c1b5074a 100644 --- a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ApplicationActionBarAdvisor.java +++ b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ApplicationActionBarAdvisor.java @@ -20,6 +20,8 @@ */ package org.apache.qpid.management.ui; +import org.apache.qpid.management.ui.actions.VersionAction; +import org.eclipse.jface.action.Action; import org.eclipse.jface.action.GroupMarker; import org.eclipse.jface.action.ICoolBarManager; import org.eclipse.jface.action.IMenuManager; @@ -44,8 +46,7 @@ public class ApplicationActionBarAdvisor extends ActionBarAdvisor // in the fill methods. This ensures that the actions aren't recreated // when fillActionBars is called with FILL_PROXY. private IWorkbenchAction exitAction; - private IWorkbenchAction aboutAction; - + private Action _aboutAction; public ApplicationActionBarAdvisor(IActionBarConfigurer configurer) { @@ -63,8 +64,8 @@ public class ApplicationActionBarAdvisor extends ActionBarAdvisor exitAction = ActionFactory.QUIT.create(window); register(exitAction); - aboutAction = ActionFactory.ABOUT.create(window); - register(aboutAction); + _aboutAction = new VersionAction(window); + register(_aboutAction); } @@ -85,8 +86,7 @@ public class ApplicationActionBarAdvisor extends ActionBarAdvisor fileMenu.add(exitAction); // Help - //aboutAction.setText("about Qpid Management Console"); - helpMenu.add(aboutAction); + helpMenu.add(_aboutAction); } protected void fillCoolBar(ICoolBarManager coolBar) diff --git a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ApplicationRegistry.java b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ApplicationRegistry.java index 714f84ea49..0693a4fc93 100644 --- a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ApplicationRegistry.java +++ b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ApplicationRegistry.java @@ -41,8 +41,9 @@ public abstract class ApplicationRegistry { private static ImageRegistry imageRegistry = new ImageRegistry(); private static FontRegistry fontRegistry = new FontRegistry(); - public static final boolean debug = Boolean.getBoolean("debug"); - public static final String securityMechanism = System.getProperty("security", null); + public static final boolean debug = Boolean.getBoolean("eclipse.consoleLog"); + public static final String securityMechanism = System.getProperty("security", null); + public static final String connectorClass = System.getProperty("jmxconnector"); static { @@ -137,4 +138,9 @@ public abstract class ApplicationRegistry { return securityMechanism; } + + public static String getJMXConnectorClass() + { + return connectorClass; + } } diff --git a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ICommandIds.java b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ICommandIds.java deleted file mode 100644 index 12dea649c6..0000000000 --- a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ICommandIds.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.management.ui; - -/** - * Interface defining the application's command IDs. - * Key bindings can be defined for specific commands. - * To associate an action with a command, use IAction.setActionDefinitionId(commandId). - * - * @see org.eclipse.jface.action.IAction#setActionDefinitionId(String) - */ -public interface ICommandIds -{ - //public static final String CMD_ADD_SERVER = "org.apache.qpid.management.ui.add"; - //public static final String CMD_RECONNECT_SERVER = "org.apache.qpid.management.ui.reconnect"; - //public static final String CMD_DISCONNECT_SERVER = "org.apache.qpid.management.ui.disconnect"; - //public static final String CMD_REFRESH = "org.apache.qpid.management.ui.actions.refresh"; -} diff --git a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/AbstractAction.java b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/AbstractAction.java index 0101905bbf..f70452dd42 100644 --- a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/AbstractAction.java +++ b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/AbstractAction.java @@ -1,3 +1,23 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ package org.apache.qpid.management.ui.actions; import static org.apache.qpid.management.ui.Constants.ERROR_SERVER_CONNECTION; @@ -6,15 +26,24 @@ import org.apache.qpid.management.ui.ApplicationRegistry; import org.apache.qpid.management.ui.ApplicationWorkbenchAdvisor; import org.apache.qpid.management.ui.Constants; import org.apache.qpid.management.ui.jmx.MBeanUtility; +import org.apache.qpid.management.ui.views.NavigationView; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; +import org.eclipse.jface.action.IAction; import org.eclipse.jface.dialogs.ErrorDialog; +import org.eclipse.jface.viewers.ISelection; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.IWorkbenchWindowActionDelegate; public class AbstractAction { + private NavigationView _navigationView; + protected IWorkbenchWindow _window; + + public static final String RMI_SASL_ERROR = "non-JRMP server"; + public static final String SECURITY_FAILURE = "User authentication has failed"; + public static final String SERVER_UNAVAILABLE = "Qpid server is not running"; /** * We will cache window object in order to @@ -28,9 +57,20 @@ public class AbstractAction { _window.getShell().setImage(ApplicationRegistry.getImage(Constants.CONSOLE_IMAGE)); } + } + + protected NavigationView getNavigationView() + { + if (_navigationView == null) + { + _navigationView = (NavigationView)_window.getActivePage().findView(NavigationView.ID); + } + + return _navigationView; } - protected void handleException(Exception ex, String title, String msg) + + protected void handleException(Throwable ex, String title, String msg) { MBeanUtility.printStackTrace(ex); if (msg == null) @@ -55,4 +95,21 @@ public class AbstractAction IStatus.OK, msg, null); ErrorDialog.openError(_window.getShell(), "Error", title, status); } + + + /** + * Selection in the workbench has been changed. We can change the state of the 'real' action here + * if we want, but this can only happen after the delegate has been created. + * @see IWorkbenchWindowActionDelegate#selectionChanged + */ + public void selectionChanged(IAction action, ISelection selection) { + } + + /** + * We can use this method to dispose of any system resources we previously allocated. + * @see IWorkbenchWindowActionDelegate#dispose + */ + public void dispose() { + + } } diff --git a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/AddServer.java b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/AddServer.java index ff0f42b49e..c13f54929d 100644 --- a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/AddServer.java +++ b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/AddServer.java @@ -22,13 +22,13 @@ package org.apache.qpid.management.ui.actions; import static org.apache.qpid.management.ui.Constants.*; +import java.io.IOException; + import org.apache.qpid.management.ui.ApplicationRegistry; import org.apache.qpid.management.ui.exceptions.InfoRequiredException; -import org.apache.qpid.management.ui.views.NavigationView; import org.apache.qpid.management.ui.views.NumberVerifyListener; import org.apache.qpid.management.ui.views.ViewUtility; import org.eclipse.jface.action.IAction; -import org.eclipse.jface.viewers.ISelection; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; @@ -47,7 +47,6 @@ public class AddServer extends AbstractAction implements IWorkbenchWindowActionD { private static final String[] _domains ={"org.apache.qpid"}; - private NavigationView _navigationView; private String _transport = DEFAULT_PROTOCOL; private String _host; private String _port; @@ -62,19 +61,6 @@ public class AddServer extends AbstractAction implements IWorkbenchWindowActionD } - /* - public AddServer(IWorkbenchWindow window)//, String label) - { - _window = window; - //setText(label); - // The id is used to refer to the action in a menu or toolbar - setId(ICommandIds.CMD_ADD_SERVER); - // Associate the action with a pre-defined command, to allow key bindings. - setActionDefinitionId(ICommandIds.CMD_ADD_SERVER); - //setImageDescriptor(org.apache.qpid.management.ui.Activator.getImageDescriptor("/icons/add.gif")); - } - */ - public void run(IAction action) { if(_window != null) @@ -92,6 +78,17 @@ public class AddServer extends AbstractAction implements IWorkbenchWindowActionD { ViewUtility.popupInfoMessage(ACTION_ADDSERVER, ex.getMessage()); } + catch (IOException ex) + { + if ((ex.getMessage() != null) && (ex.getMessage().indexOf(RMI_SASL_ERROR) != -1)) + { + handleException(ex, null, SECURITY_FAILURE); + } + else + { + handleException(ex, null, SERVER_UNAVAILABLE); + } + } catch (Exception ex) { handleException(ex, null, null); @@ -110,45 +107,6 @@ public class AddServer extends AbstractAction implements IWorkbenchWindowActionD } /** - * Selection in the workbench has been changed. We - * can change the state of the 'real' action here - * if we want, but this can only happen after - * the delegate has been created. - * @see IWorkbenchWindowActionDelegate#selectionChanged - */ - public void selectionChanged(IAction action, ISelection selection) { - } - - /** - * We can use this method to dispose of any system - * resources we previously allocated. - * @see IWorkbenchWindowActionDelegate#dispose - */ - public void dispose() { - - } - - private NavigationView getNavigationView() - { - if (_navigationView == null) - { - _navigationView = (NavigationView)_window.getActivePage().findView(NavigationView.ID); - } - - return _navigationView; - } - - /* - public void run() - { - if(_window != null) - { - createWidgets(); - } - } - */ - - /** * Creates the shell and then opens the popup where user can enter new connection details. * Connects to the new server and adds the server in the navigation page. * Pops up any error occured in connecting to the new server diff --git a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/CloseConnection.java b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/CloseConnection.java index 3907424748..a3e52149df 100644 --- a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/CloseConnection.java +++ b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/CloseConnection.java @@ -25,7 +25,6 @@ import org.apache.qpid.management.ui.exceptions.InfoRequiredException; import org.apache.qpid.management.ui.views.NavigationView; import org.apache.qpid.management.ui.views.ViewUtility; import org.eclipse.jface.action.IAction; -import org.eclipse.jface.viewers.ISelection; import org.eclipse.ui.IWorkbenchWindowActionDelegate; public class CloseConnection extends AbstractAction implements IWorkbenchWindowActionDelegate @@ -53,24 +52,5 @@ public class CloseConnection extends AbstractAction implements IWorkbenchWindowA handleException(ex, null, null); } } - } - - /** - * Selection in the workbench has been changed. We - * can change the state of the 'real' action here - * if we want, but this can only happen after - * the delegate has been created. - * @see IWorkbenchWindowActionDelegate#selectionChanged - */ - public void selectionChanged(IAction action, ISelection selection) { - } - - /** - * We can use this method to dispose of any system - * resources we previously allocated. - * @see IWorkbenchWindowActionDelegate#dispose - */ - public void dispose() { - - } + } } diff --git a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/EditAttribute.java b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/EditAttribute.java index 69e74898ab..d3af3661b0 100644 --- a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/EditAttribute.java +++ b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/EditAttribute.java @@ -25,7 +25,6 @@ import org.apache.qpid.management.ui.exceptions.InfoRequiredException; import org.apache.qpid.management.ui.views.MBeanView; import org.apache.qpid.management.ui.views.ViewUtility; import org.eclipse.jface.action.IAction; -import org.eclipse.jface.viewers.ISelection; import org.eclipse.ui.IWorkbenchWindowActionDelegate; public class EditAttribute extends AbstractAction implements IWorkbenchWindowActionDelegate @@ -49,23 +48,4 @@ public class EditAttribute extends AbstractAction implements IWorkbenchWindowAct } } } - - /** - * Selection in the workbench has been changed. We - * can change the state of the 'real' action here - * if we want, but this can only happen after - * the delegate has been created. - * @see IWorkbenchWindowActionDelegate#selectionChanged - */ - public void selectionChanged(IAction action, ISelection selection) { - } - - /** - * We can use this method to dispose of any system - * resources we previously allocated. - * @see IWorkbenchWindowActionDelegate#dispose - */ - public void dispose() { - - } } diff --git a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/ReconnectServer.java b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/ReconnectServer.java index 3c0dea586e..609484a557 100644 --- a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/ReconnectServer.java +++ b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/ReconnectServer.java @@ -27,14 +27,14 @@ import static org.apache.qpid.management.ui.Constants.INFO_USERNAME; import static org.apache.qpid.management.ui.Constants.PASSWORD; import static org.apache.qpid.management.ui.Constants.USERNAME; +import java.io.IOException; + import org.apache.qpid.management.ui.ApplicationRegistry; import org.apache.qpid.management.ui.Constants; import org.apache.qpid.management.ui.exceptions.InfoRequiredException; -import org.apache.qpid.management.ui.views.NavigationView; import org.apache.qpid.management.ui.views.TreeObject; import org.apache.qpid.management.ui.views.ViewUtility; import org.eclipse.jface.action.IAction; -import org.eclipse.jface.viewers.ISelection; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; @@ -50,45 +50,12 @@ import org.eclipse.ui.IWorkbenchWindowActionDelegate; public class ReconnectServer extends AbstractAction implements IWorkbenchWindowActionDelegate { - private NavigationView _navigationView; private String _title; private String _serverName; private String _user; private String _password; private boolean _connect; - /** - * Selection in the workbench has been changed. We - * can change the state of the 'real' action here - * if we want, but this can only happen after - * the delegate has been created. - * @see IWorkbenchWindowActionDelegate#selectionChanged - */ - public void selectionChanged(IAction action, ISelection selection) - { - - } - - /** - * We can use this method to dispose of any system - * resources we previously allocated. - * @see IWorkbenchWindowActionDelegate#dispose - */ - public void dispose() - { - - } - - private NavigationView getNavigationView() - { - if (_navigationView == null) - { - _navigationView = (NavigationView)_window.getActivePage().findView(NavigationView.ID); - } - - return _navigationView; - } - public void run(IAction action) { if(_window != null) @@ -114,6 +81,17 @@ public class ReconnectServer extends AbstractAction implements IWorkbenchWindowA { ViewUtility.popupInfoMessage("Reconnect Qpid server", ex.getMessage()); } + catch (IOException ex) + { + if ((ex.getMessage() != null) && (ex.getMessage().indexOf(RMI_SASL_ERROR) != -1)) + { + handleException(ex, null, SECURITY_FAILURE); + } + else + { + handleException(ex, null, SERVER_UNAVAILABLE); + } + } catch (Exception ex) { handleException(ex, null, null); diff --git a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/Refresh.java b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/Refresh.java index b76c36c649..34251c12d7 100644 --- a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/Refresh.java +++ b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/Refresh.java @@ -24,7 +24,6 @@ import org.apache.qpid.management.ui.jmx.MBeanUtility; import org.apache.qpid.management.ui.views.MBeanView; import org.apache.qpid.management.ui.views.NavigationView; import org.eclipse.jface.action.IAction; -import org.eclipse.jface.viewers.ISelection; import org.eclipse.ui.IWorkbenchWindowActionDelegate; /** @@ -32,29 +31,7 @@ import org.eclipse.ui.IWorkbenchWindowActionDelegate; * @author Bhupendra Bhardwaj */ public class Refresh extends AbstractAction implements IWorkbenchWindowActionDelegate -{ - /** - * Selection in the workbench has been changed. We - * can change the state of the 'real' action here - * if we want, but this can only happen after - * the delegate has been created. - * @see IWorkbenchWindowActionDelegate#selectionChanged - */ - public void selectionChanged(IAction action, ISelection selection) - { - - } - - /** - * We can use this method to dispose of any system - * resources we previously allocated. - * @see IWorkbenchWindowActionDelegate#dispose - */ - public void dispose() - { - - } - +{ public void run(IAction action) { if(_window != null) diff --git a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/RemoveServer.java b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/RemoveServer.java index f8878c44a1..e329255414 100644 --- a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/RemoveServer.java +++ b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/RemoveServer.java @@ -24,33 +24,10 @@ import org.apache.qpid.management.ui.exceptions.InfoRequiredException; import org.apache.qpid.management.ui.views.NavigationView; import org.apache.qpid.management.ui.views.ViewUtility; import org.eclipse.jface.action.IAction; -import org.eclipse.jface.viewers.ISelection; import org.eclipse.ui.IWorkbenchWindowActionDelegate; public class RemoveServer extends AbstractAction implements IWorkbenchWindowActionDelegate -{ - /** - * Selection in the workbench has been changed. We - * can change the state of the 'real' action here - * if we want, but this can only happen after - * the delegate has been created. - * @see IWorkbenchWindowActionDelegate#selectionChanged - */ - public void selectionChanged(IAction action, ISelection selection) - { - - } - - /** - * We can use this method to dispose of any system - * resources we previously allocated. - * @see IWorkbenchWindowActionDelegate#dispose - */ - public void dispose() - { - - } - +{ public void run(IAction action) { if(_window != null) diff --git a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/VersionAction.java b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/VersionAction.java new file mode 100644 index 0000000000..11db02f5a2 --- /dev/null +++ b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/VersionAction.java @@ -0,0 +1,89 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.qpid.management.ui.actions; + +import java.io.InputStream; +import java.util.Properties; + +import org.apache.qpid.management.ui.Constants; +import org.apache.qpid.management.ui.jmx.MBeanUtility; +import org.eclipse.jface.action.Action; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.ui.IWorkbenchWindow; + +public class VersionAction extends Action +{ + private IWorkbenchWindow _window; + public static final String VERSION_RESOURCE = "qpidversion.properties"; + + public static final String PRODUCT_NAME_PROPERTY = "qpid.name"; + public static final String RELEASE_VERSION_PROPERTY = "qpid.version"; + public static final String BUILD_VERSION_PROPERTY = "qpid.svnversion"; + + private static final String DEFAULT = "unknown"; + private static String _releaseVersion; + private static String _buildVersion; + private static String _text; + + static + { + Properties props = new Properties(); + try + { + InputStream propertyStream = VersionAction.class.getClassLoader().getResourceAsStream(VERSION_RESOURCE); + if (propertyStream != null) + { + props.load(propertyStream); + _releaseVersion = readPropertyValue(props, RELEASE_VERSION_PROPERTY); + _buildVersion = readPropertyValue(props, BUILD_VERSION_PROPERTY); + _text = "Build Version : " + _buildVersion + "\n" + + "Release Version : " + _releaseVersion; + } + } + catch (Exception ex) + { + MBeanUtility.printStackTrace(ex); + } + } + + public VersionAction(IWorkbenchWindow window) + { + _window = window; + setText("About " + Constants.APPLICATION_NAME); + setId("qpidmc.about"); + setActionDefinitionId("qpidmc.about"); + } + + private static String readPropertyValue(Properties props, String propertyName) + { + String retVal = (String) props.get(propertyName); + if (retVal == null) + { + retVal = DEFAULT; + } + return retVal; + } + + public void run() + { + MessageDialog.openInformation(_window.getShell(), Constants.APPLICATION_NAME, _text); + } +} diff --git a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/JMXServerRegistry.java b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/JMXServerRegistry.java index 816c479cf9..988b22b4cf 100644 --- a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/JMXServerRegistry.java +++ b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/JMXServerRegistry.java @@ -39,6 +39,7 @@ import javax.management.ObjectName; import javax.management.remote.JMXConnector; import javax.management.remote.JMXConnectorFactory; import javax.management.remote.JMXServiceURL; +import javax.security.auth.callback.CallbackHandler; import javax.security.sasl.SaslClientFactory; import org.apache.qpid.management.ui.ApplicationRegistry; @@ -58,6 +59,8 @@ import org.apache.qpid.management.ui.sasl.UsernameHashedPasswordCallbackHandler; public class JMXServerRegistry extends ServerRegistry { private ObjectName _serverObjectName = null; + private Map<String, Object> _env = null; + private JMXServiceURL _jmxUrl = null; private JMXConnector _jmxc = null; private MBeanServerConnection _mbsc = null; @@ -92,68 +95,28 @@ public class JMXServerRegistry extends ServerRegistry public JMXServerRegistry(ManagedServer server) throws Exception { super(server); - JMXServiceURL jmxUrl = new JMXServiceURL(server.getUrl()); - Map<String, Object> env = null; String securityMechanism = ApplicationRegistry.getSecurityMechanism(); + String connectorClassName = ApplicationRegistry.getJMXConnectorClass(); + + boolean saslPluginAvailable = false; - if (securityMechanism != null) - { + if ((securityMechanism != null) && (connectorClassName != null)) + { try { - // Check if the JMXMP connector is available - Class klass = Class.forName("javax.management.remote.jmxmp.JMXMPConnector"); - - jmxUrl = new JMXServiceURL("jmxmp", server.getHost(), server.getPort()); - env = new HashMap<String, Object>(); - - if (MECH_CRAMMD5.equals(securityMechanism)) - { - // For SASL/CRAM-MD5 - Map<String, Class<? extends SaslClientFactory>> map = new HashMap<String, Class<? extends SaslClientFactory>>(); - Class<?> clazz = Class.forName("org.apache.qpid.management.ui.sasl.CRAMMD5HashedSaslClientFactory"); - map.put("CRAM-MD5-HASHED", (Class<? extends SaslClientFactory>) clazz); - - Security.addProvider(new JCAProvider(map)); - env.put("jmx.remote.profiles", SASL_CRAMMD5); - env.put("jmx.remote.sasl.callback.handler", - new UsernameHashedPasswordCallbackHandler(server.getUser(), server.getPassword())); - } - else if (MECH_PLAIN.equals(securityMechanism)) - { - // For SASL/PLAIN - Security.addProvider(new SaslProvider()); - env.put("jmx.remote.profiles", SASL_PLAIN); - env.put("jmx.remote.sasl.callback.handler", - new UserPasswordCallbackHandler(server.getUser(), server.getPassword())); - } - else - { - MBeanUtility.printOutput("Security mechanism " + securityMechanism + " is not supported."); - } - - // Now create the instance of JMXMPConnector - Class[] paramTypes = {JMXServiceURL.class, Map.class}; - Constructor cons = klass.getConstructor(paramTypes); - - Object[] args = {jmxUrl, env}; - Object theObject = cons.newInstance(args); - - _jmxc = (JMXConnector)theObject; - _jmxc.connect(); - MBeanUtility.printOutput("Starting JMXConnector with SASL. Server=" + server.getName()); + createSASLConnector(securityMechanism, connectorClassName); + saslPluginAvailable = true; } catch (Exception ex) { - // When JMXMPConnector is not available - MBeanUtility.printOutput("Starting JMXConnector. Server=" + server.getName()); - jmxUrl = new JMXServiceURL(server.getUrl()); - _jmxc = JMXConnectorFactory.connect(jmxUrl, null); + MBeanUtility.printStackTrace(ex); } } - else + + if (!saslPluginAvailable) { - jmxUrl = new JMXServiceURL(server.getUrl()); - _jmxc = JMXConnectorFactory.connect(jmxUrl, null); + _jmxUrl = new JMXServiceURL(server.getUrl()); + _jmxc = JMXConnectorFactory.connect(_jmxUrl, null); } _mbsc = _jmxc.getMBeanServerConnection(); @@ -171,6 +134,53 @@ public class JMXServerRegistry extends ServerRegistry return _mbsc; } + private void createSASLConnector(String mech, String className) throws Exception + { + String text = "Security mechanism " + mech + " is not supported."; + // Check if the given connector, which supports SASL is available + Class connectorClass = Class.forName(className); + + _jmxUrl = new JMXServiceURL("jmxmp", getManagedServer().getHost(), getManagedServer().getPort()); + _env = new HashMap<String, Object>(); + CallbackHandler handler; + if (MECH_CRAMMD5.equals(mech)) + { + // For SASL/CRAM-MD5 + Map<String, Class<? extends SaslClientFactory>> map = new HashMap<String, Class<? extends SaslClientFactory>>(); + Class<?> clazz = Class.forName("org.apache.qpid.management.ui.sasl.CRAMMD5HashedSaslClientFactory"); + map.put("CRAM-MD5-HASHED", (Class<? extends SaslClientFactory>) clazz); + + Security.addProvider(new JCAProvider(map)); + handler = new UsernameHashedPasswordCallbackHandler(getManagedServer().getUser(), + getManagedServer().getPassword()); + _env.put("jmx.remote.profiles", SASL_CRAMMD5); + _env.put("jmx.remote.sasl.callback.handler", handler); + + } + else if (MECH_PLAIN.equals(mech)) + { + // For SASL/PLAIN + Security.addProvider(new SaslProvider()); + handler = new UserPasswordCallbackHandler(getManagedServer().getUser(), getManagedServer().getPassword()); + _env.put("jmx.remote.profiles", SASL_PLAIN); + _env.put("jmx.remote.sasl.callback.handler", handler); + } + else + { + MBeanUtility.printOutput(text); + throw new Exception(text); + } + // Now create the instance of JMXMPConnector + Class[] paramTypes = {JMXServiceURL.class, Map.class}; + Constructor cons = connectorClass.getConstructor(paramTypes); + + Object[] args = {_jmxUrl, _env}; + Object theObject = cons.newInstance(args); + + _jmxc = (JMXConnector)theObject; + _jmxc.connect(); + } + /** * removes all listeners from the mbean server. This is required when user * disconnects the Qpid server connection diff --git a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/NavigationView.java b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/NavigationView.java index e5f99c2f7b..1da13a9b56 100644 --- a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/NavigationView.java +++ b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/NavigationView.java @@ -208,16 +208,9 @@ public class NavigationView extends ViewPart */ private void createRMIServerConnection(ManagedServer server) throws Exception { - try - { - // Currently Qpid Management Console only supports JMX MBeanServer - ServerRegistry serverRegistry = new JMXServerRegistry(server); - ApplicationRegistry.addServer(server, serverRegistry); - } - catch (IOException ex) - { - throw (Exception)ex.getCause(); - } + // Currently Qpid Management Console only supports JMX MBeanServer + ServerRegistry serverRegistry = new JMXServerRegistry(server); + ApplicationRegistry.addServer(server, serverRegistry); } /** diff --git a/java/management/eclipse-plugin/src/main/resources/sasl/MANIFEST.MF b/java/management/eclipse-plugin/src/main/resources/sasl/MANIFEST.MF index 7a9e5caaaf..ad274a8f89 100644 --- a/java/management/eclipse-plugin/src/main/resources/sasl/MANIFEST.MF +++ b/java/management/eclipse-plugin/src/main/resources/sasl/MANIFEST.MF @@ -1,19 +1,8 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: Jmxmp Plug-in -Bundle-SymbolicName: jmxremote.optional -Bundle-Version: 1.0.1 -Bundle-ClassPath: . -Bundle-Vendor: -Bundle-Localization: plugin -Export-Package: com.sun.jmx.remote.generic, - com.sun.jmx.remote.opt.internal, - com.sun.jmx.remote.opt.security, - com.sun.jmx.remote.opt.util, - com.sun.jmx.remote.profile.sasl, - com.sun.jmx.remote.profile.tls, - com.sun.jmx.remote.protocol.jmxmp, - com.sun.jmx.remote.socket, - javax.management.remote.generic, - javax.management.remote.jmxmp, - javax.management.remote.message +Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: jmx sasl Plug-in
+Bundle-SymbolicName: jmxremote.sasl
+Bundle-Version: 1.0.1
+Bundle-ClassPath: .
+Bundle-Vendor:
+Bundle-Localization: plugin
diff --git a/java/management/eclipse-plugin/src/main/resources/win32/configuration/config.ini b/java/management/eclipse-plugin/src/main/resources/win32/configuration/config.ini index 1762840aff..e83321e650 100644 --- a/java/management/eclipse-plugin/src/main/resources/win32/configuration/config.ini +++ b/java/management/eclipse-plugin/src/main/resources/win32/configuration/config.ini @@ -22,5 +22,5 @@ osgi.splashPath=platform:/base/plugins/org.apache.qpid.management.ui
eclipse.product=org.apache.qpid.management.ui.product
eclipse.application=org.apache.qpid.management.ui.application
-osgi.bundles=org.eclipse.equinox.common@2:start,org.eclipse.core.runtime@start,com.ibm.icu,org.apache.qpid.management.ui,org.eclipse.core.commands,org.eclipse.core.contenttype,org.eclipse.core.expressions,org.eclipse.core.jobs,org.eclipse.core.runtime.compatibility.auth,org.eclipse.core.runtime.compatibility.registry,org.eclipse.equinox.preferences,org.eclipse.equinox.registry,org.eclipse.help,org.eclipse.jface,org.eclipse.swt,org.eclipse.swt.win32.win32.x86,org.eclipse.ui,org.eclipse.ui.forms,jmxremote.optional,org.eclipse.ui.workbench
+osgi.bundles=org.eclipse.equinox.common@2:start,org.eclipse.core.runtime@start,com.ibm.icu,org.apache.qpid.management.ui,org.eclipse.core.commands,org.eclipse.core.contenttype,org.eclipse.core.expressions,org.eclipse.core.jobs,org.eclipse.core.runtime.compatibility.auth,org.eclipse.core.runtime.compatibility.registry,org.eclipse.equinox.preferences,org.eclipse.equinox.registry,org.eclipse.help,org.eclipse.jface,org.eclipse.swt,org.eclipse.swt.win32.win32.x86,org.eclipse.ui,org.eclipse.ui.forms,jmxremote.sasl,org.eclipse.ui.workbench
osgi.bundles.defaultStartLevel=4
diff --git a/java/perftests/etc/scripts/sendAndWaitClient.sh b/java/perftests/etc/scripts/sendAndWaitClient.sh new file mode 100755 index 0000000000..af4b788658 --- /dev/null +++ b/java/perftests/etc/scripts/sendAndWaitClient.sh @@ -0,0 +1,22 @@ +#!/bin/bash +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# + +$JAVA_HOME/bin/java -Dlog4j.configuration=backup-log4j.xml -cp qpid-perftests-1.0-incubating-M2-SNAPSHOT-all-test-deps.jar org.apache.qpid.ping.PingSendOnlyClient messageSize=512 diff --git a/java/perftests/src/main/java/org/apache/qpid/ping/PingSendOnlyClient.java b/java/perftests/src/main/java/org/apache/qpid/ping/PingSendOnlyClient.java index 7cf5e4516f..29757a20ba 100644 --- a/java/perftests/src/main/java/org/apache/qpid/ping/PingSendOnlyClient.java +++ b/java/perftests/src/main/java/org/apache/qpid/ping/PingSendOnlyClient.java @@ -6,6 +6,12 @@ import java.util.Properties; import org.apache.log4j.Logger;
import org.apache.qpid.util.CommandLineParser;
+import org.apache.qpid.client.message.TestMessageFactory;
+
+import javax.jms.ObjectMessage;
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.Message;
/**
* <p><table id="crc"><caption>CRC Card</caption>
@@ -32,7 +38,7 @@ public class PingSendOnlyClient extends PingDurableClient {
// Create a ping producer overriding its defaults with all options passed on the command line.
Properties options = CommandLineParser.processCommandLine(args, new CommandLineParser(new String[][] {}));
- PingDurableClient pingProducer = new PingSendOnlyClient(options);
+ PingSendOnlyClient pingProducer = new PingSendOnlyClient(options);
// Create a shutdown hook to terminate the ping-pong producer.
Runtime.getRuntime().addShutdownHook(pingProducer.getShutdownHook());
@@ -54,4 +60,14 @@ public class PingSendOnlyClient extends PingDurableClient System.exit(1);
}
}
+
+ public Message getTestMessage(Destination replyQueue, int messageSize, boolean persistent) throws JMSException
+ {
+ Message msg = TestMessageFactory.newTextMessage(_producerSession, messageSize);
+
+ // Timestamp the message in nanoseconds.
+ msg.setLongProperty(MESSAGE_TIMESTAMP_PROPNAME, System.nanoTime());
+
+ return msg;
+ }
}
diff --git a/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongProducer.java b/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongProducer.java index ecaf27167f..5dec2125ee 100644 --- a/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongProducer.java +++ b/java/perftests/src/main/java/org/apache/qpid/requestreply/PingPongProducer.java @@ -1049,7 +1049,7 @@ public class PingPongProducer implements Runnable, MessageListener, ExceptionLis try
{
// Generate a sample message and time stamp it.
- ObjectMessage msg = getTestMessage(_replyDestination, _messageSize, _persistent);
+ Message msg = getTestMessage(_replyDestination, _messageSize, _persistent);
msg.setLongProperty(MESSAGE_TIMESTAMP_PROPNAME, System.nanoTime());
// Send the message and wait for a reply.
@@ -1096,7 +1096,7 @@ public class PingPongProducer implements Runnable, MessageListener, ExceptionLis *
* @throws javax.jms.JMSException All underlying JMSException are allowed to fall through.
*/
- public ObjectMessage getTestMessage(Destination replyQueue, int messageSize, boolean persistent) throws JMSException
+ public Message getTestMessage(Destination replyQueue, int messageSize, boolean persistent) throws JMSException
{
ObjectMessage msg = TestMessageFactory.newObjectMessage(_producerSession, replyQueue, messageSize, persistent);
diff --git a/java/perftests/src/test/java/org/apache/qpid/ping/PingLatencyTestPerf.java b/java/perftests/src/test/java/org/apache/qpid/ping/PingLatencyTestPerf.java index b303e16d2c..c822964152 100644 --- a/java/perftests/src/test/java/org/apache/qpid/ping/PingLatencyTestPerf.java +++ b/java/perftests/src/test/java/org/apache/qpid/ping/PingLatencyTestPerf.java @@ -168,7 +168,7 @@ public class PingLatencyTestPerf extends PingTestPerf implements TimingControlle pingClient.setChainedMessageListener(batchedResultsListener);
// Generate a sample message of the specified size.
- ObjectMessage msg =
+ Message msg =
pingClient.getTestMessage(perThreadSetup._pingClient.getReplyDestinations().get(0),
testParameters.getPropertyAsInteger(PingPongProducer.MESSAGE_SIZE_PROPNAME),
testParameters.getPropertyAsBoolean(PingPongProducer.PERSISTENT_MODE_PROPNAME));
diff --git a/java/perftests/src/test/java/org/apache/qpid/ping/PingTestPerf.java b/java/perftests/src/test/java/org/apache/qpid/ping/PingTestPerf.java index fd3bc3ff23..6e8bf65198 100644 --- a/java/perftests/src/test/java/org/apache/qpid/ping/PingTestPerf.java +++ b/java/perftests/src/test/java/org/apache/qpid/ping/PingTestPerf.java @@ -140,7 +140,7 @@ public class PingTestPerf extends AsymptoticTestCase implements TestThreadAware }
// Generate a sample message. This message is already time stamped and has its reply-to destination set.
- ObjectMessage msg =
+ Message msg =
perThreadSetup._pingClient.getTestMessage(perThreadSetup._pingClient.getReplyDestinations().get(0),
testParameters.getPropertyAsInteger(PingPongProducer.MESSAGE_SIZE_PROPNAME),
testParameters.getPropertyAsBoolean(PingPongProducer.PERSISTENT_MODE_PROPNAME));
diff --git a/java/perftests/src/test/java/org/apache/qpid/requestreply/PingPongTestPerf.java b/java/perftests/src/test/java/org/apache/qpid/requestreply/PingPongTestPerf.java index a09324b568..9a9f9ba6b5 100644 --- a/java/perftests/src/test/java/org/apache/qpid/requestreply/PingPongTestPerf.java +++ b/java/perftests/src/test/java/org/apache/qpid/requestreply/PingPongTestPerf.java @@ -148,7 +148,7 @@ public class PingPongTestPerf extends AsymptoticTestCase PerThreadSetup perThreadSetup = threadSetup.get();
// Generate a sample message. This message is already time stamped and has its reply-to destination set.
- ObjectMessage msg =
+ Message msg =
perThreadSetup._testPingProducer.getTestMessage(perThreadSetup._testPingProducer.getReplyDestinations().get(0),
testParameters.getPropertyAsInteger(PingPongProducer.MESSAGE_SIZE_PROPNAME),
testParameters.getPropertyAsBoolean(PingPongProducer.PERSISTENT_MODE_PROPNAME));
|