No, its a remoting integration aspect that needs to be supplied. Its simple enough to
create one as this example does. The based aspects for the client should be externalized
though, and the jndi binding should be done via an aspect on this bean. I have created a
jbas issue for the replacement.
http://jira.jboss.com/jira/browse/JBAS-4456
| package org.jboss.profileservice.remoting;
|
| import java.util.ArrayList;
|
| import javax.naming.InitialContext;
|
| import org.jboss.aop.Dispatcher;
| import org.jboss.aop.advice.Interceptor;
| import org.jboss.aop.proxy.Proxy;
| import org.jboss.aspects.remoting.InvokeRemoteInterceptor;
| import org.jboss.aspects.remoting.MergeMetaDataInterceptor;
| import org.jboss.aspects.remoting.Remoting;
| import org.jboss.aspects.security.SecurityClientInterceptor;
| import org.jboss.deployers.spi.management.ManagementView;
| import org.jboss.logging.Logger;
| import org.jboss.profileservice.spi.ProfileService;
| import org.jboss.remoting.InvokerLocator;
| import org.jboss.util.naming.Util;
|
| /**
| * An aop/remoting proxy factory bean that exposes the ProfileService
| * interfaces.
| *
| * @author Scott.Stark(a)jboss.org
| * @version $Revision:$
| */
| public class ProxyFactory
| {
| private static final Logger log = Logger.getLogger(ProxyFactory.class);
| private String dispatchName = "ProfileService";
| private String jndiName = "ProfileService";
| private InvokerLocator locator;
| private ProfileService ps;
| private ManagementView mgtView;
| private Proxy psProxy;
| private Proxy mgtViewProxy;
|
| public String getDispatchName()
| {
| return dispatchName;
| }
|
| public void setDispatchName(String dispatchName)
| {
| this.dispatchName = dispatchName;
| }
|
| public String getJndiName()
| {
| return jndiName;
| }
|
| public void setJndiName(String jndiName)
| {
| this.jndiName = jndiName;
| }
|
| public InvokerLocator getLocator()
| {
| return locator;
| }
|
| public void setLocator(InvokerLocator locator)
| {
| this.locator = locator;
| }
|
| public ProfileService getProfileService()
| {
| return ps;
| }
|
| public void setProfileService(ProfileService ps)
| {
| this.ps = ps;
| }
|
| public Proxy getProfileServiceProxy()
| {
| return psProxy;
| }
|
| public ManagementView getViewManager()
| {
| return mgtView;
| }
| public void setViewManager(ManagementView mgtView)
| {
| this.mgtView = mgtView;
| }
|
| public Proxy getManagementViewProxy()
| {
| return mgtViewProxy;
| }
|
| public void start()
| throws Exception
| {
| ClassLoader loader = Thread.currentThread().getContextClassLoader();
| Class[] ifaces = {ProfileService.class};
|
| // Create the ProfileService proxy
| Dispatcher.singleton.registerTarget(dispatchName, ps);
|
| ArrayList<Interceptor> interceptors = new ArrayList<Interceptor>();
| interceptors.add(SecurityClientInterceptor.singleton);
| interceptors.add(MergeMetaDataInterceptor.singleton);
| interceptors.add(InvokeRemoteInterceptor.singleton);
|
| psProxy = Remoting.createRemoteProxy(dispatchName, loader, ifaces, locator,
| interceptors, "ProfileService");
| InitialContext ctx = new InitialContext();
| Util.bind(ctx, jndiName, psProxy);
|
| // Create the ManagementView proxy
| Class[] mvIfaces = {ManagementView.class};
| String mvDispatchName = dispatchName+".ManagementView";
| Dispatcher.singleton.registerTarget(mvDispatchName, mgtView);
| mgtViewProxy = Remoting.createRemoteProxy(mvDispatchName, loader, mvIfaces,
locator,
| interceptors, "ProfileService");
| log.debug("Bound ProfileService proxy");
| }
|
| public void stop()
| throws Exception
| {
| ClassLoader loader = Thread.currentThread().getContextClassLoader();
| Dispatcher.singleton.unregisterTarget(dispatchName);
| String mvDispatchName = dispatchName+".ManagementView";
| Dispatcher.singleton.unregisterTarget(mvDispatchName);
| InitialContext ctx = new InitialContext();
| Util.unbind(ctx, jndiName);
| log.debug("Unbound ProfileService proxy");
| }
| }
|
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4050299#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...