001/* 002 * jPOS Project [http://jpos.org] 003 * Copyright (C) 2000-2026 jPOS Software SRL 004 * 005 * This program is free software: you can redistribute it and/or modify 006 * it under the terms of the GNU Affero General Public License as 007 * published by the Free Software Foundation, either version 3 of the 008 * License, or (at your option) any later version. 009 * 010 * This program is distributed in the hope that it will be useful, 011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 013 * GNU Affero General Public License for more details. 014 * 015 * You should have received a copy of the GNU Affero General Public License 016 * along with this program. If not, see <http://www.gnu.org/licenses/>. 017 */ 018 019package org.jpos.q2.iso; 020 021import org.jpos.q2.QBeanSupport; 022import org.jpos.util.NameRegistrar; 023import org.jpos.util.NameRegistrar.NotFoundException; 024 025import javax.naming.InitialContext; 026import javax.naming.NamingException; 027import java.rmi.RemoteException; 028 029/** 030 * Remote Space Proxy Adaptor. 031 * 032 * @author Mark Salter 033 * @author Alwyn Schoeman 034 * @version $Revision: 2854 $ $Date: 2010-01-02 10:34:31 +0000 (Sat, 02 Jan 2010) $ 035 */ 036 037public class QMUXProxyAdaptor 038 extends QBeanSupport 039 implements QMUXProxyAdaptorMBean 040{ 041 private QMUXProxy qmuxproxy = null; 042 private String qmuxName; 043 private QMUX qmux; 044 045 /** Default constructor. */ 046 public QMUXProxyAdaptor () { 047 super (); 048 } 049 050 protected void startService () throws RemoteException, NamingException, NotFoundException { 051 qmux = (QMUX) NameRegistrar.get(qmuxName); 052 qmuxproxy = new QMUXProxy(qmux); 053 InitialContext ctx = new InitialContext (); 054 ctx.rebind (getName (), qmuxproxy); 055 } 056 057 protected void stopService () throws NamingException { 058 InitialContext ctx = new InitialContext (); 059 ctx.unbind(getName()); 060 } 061 062 public synchronized void setQmuxName (String muxName) { 063 this.qmuxName = muxName; 064 setAttr (getAttrs (), "qmuxName", muxName); 065 setModified (true); 066 } 067 068 public String getQmuxName () { 069 return qmuxName; 070 } 071 072} 073 074