Java Code Examples for org.springframework.remoting.rmi.RmiProxyFactoryBean#setServiceInterface()

The following examples show how to use org.springframework.remoting.rmi.RmiProxyFactoryBean#setServiceInterface() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RemoteClientSpringApplication.java    From spring-5-examples with MIT License 6 votes vote down vote up
@Bean RmiProxyFactoryBean userService(@Value("${rmi.server.host:0.0.0.0}") final String rmiServerHost) {
  final RmiProxyFactoryBean rmiProxyFactoryBean = new RmiProxyFactoryBean();
  rmiProxyFactoryBean.setServiceUrl(format("rmi://%s:1199/UserService", rmiServerHost));
  rmiProxyFactoryBean.setServiceInterface(UserService.class);
  rmiProxyFactoryBean.setLookupStubOnStartup(false); // fail safe on startup
  return rmiProxyFactoryBean;
}
 
Example 2
Source File: RmiRemoteInputStreamServer.java    From alfresco-repository with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * Utility method to lookup a remote stream peer over RMI.
 */
public static RemoteInputStreamServer obtain(String host, int port, String name) throws RemoteException
{
    RmiProxyFactoryBean rmiProxyFactoryBean = new RmiProxyFactoryBean();
    rmiProxyFactoryBean.setServiceUrl("rmi://" + host + ":" + port + "/" + name);
    rmiProxyFactoryBean.setServiceInterface(RemoteInputStreamServer.class);
    rmiProxyFactoryBean.setRefreshStubOnConnectFailure(true);
    try
    {
        rmiProxyFactoryBean.afterPropertiesSet();
    }
    catch (Exception e)
    {
        throw new RemoteException("Error create rmi proxy");
    }
    return (RemoteInputStreamServer) rmiProxyFactoryBean.getObject();
}
 
Example 3
Source File: RmiProtocol.java    From dubbo-2.6.5 with Apache License 2.0 6 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
protected <T> T doRefer(final Class<T> serviceType, final URL url) throws RpcException {
    final RmiProxyFactoryBean rmiProxyFactoryBean = new RmiProxyFactoryBean();
    // RMI needs extra parameter since it uses customized remote invocation object
    if (url.getParameter(Constants.DUBBO_VERSION_KEY, Version.getProtocolVersion()).equals(Version.getProtocolVersion())) {
        // Check dubbo version on provider, this feature only support
        rmiProxyFactoryBean.setRemoteInvocationFactory(new RemoteInvocationFactory() {
            @Override
            public RemoteInvocation createRemoteInvocation(MethodInvocation methodInvocation) {
                return new RmiRemoteInvocation(methodInvocation);
            }
        });
    }
    rmiProxyFactoryBean.setServiceUrl(url.toIdentityString());
    rmiProxyFactoryBean.setServiceInterface(serviceType);
    rmiProxyFactoryBean.setCacheStub(true);
    rmiProxyFactoryBean.setLookupStubOnStartup(true);
    rmiProxyFactoryBean.setRefreshStubOnConnectFailure(true);
    rmiProxyFactoryBean.afterPropertiesSet();
    return (T) rmiProxyFactoryBean.getObject();
}
 
Example 4
Source File: StockRmiContext.java    From OpERP with MIT License 5 votes vote down vote up
@Bean
public RmiProxyFactoryBean stockService() {
	RmiProxyFactoryBean rmiProxy = new RmiProxyFactoryBean();
	rmiProxy.setServiceUrl(rmiUrl + "/StockService");
	rmiProxy.setServiceInterface(StockService.class);
	return rmiProxy;
}
 
Example 5
Source File: ItemRmiContext.java    From OpERP with MIT License 5 votes vote down vote up
@Bean
public RmiProxyFactoryBean itemService() {
	RmiProxyFactoryBean rmiProxy = new RmiProxyFactoryBean();
	rmiProxy.setServiceUrl(rmiUrl + "/ItemService");
	rmiProxy.setServiceInterface(ItemService.class);
	return rmiProxy;
}
 
Example 6
Source File: AccountRmiContext.java    From OpERP with MIT License 5 votes vote down vote up
@Bean
public RmiProxyFactoryBean paidTransactionService() {
	RmiProxyFactoryBean rmiProxy = new RmiProxyFactoryBean();
	rmiProxy.setServiceInterface(PaidTransactionService.class);
	String serviceName = rmiProxy.getServiceInterface().getCanonicalName();
	rmiProxy.setServiceUrl(rmiUrl + "/" + serviceName);
	return rmiProxy;
}
 
Example 7
Source File: ItemRmiContext.java    From OpERP with MIT License 5 votes vote down vote up
@Bean
public RmiProxyFactoryBean categoryService() {
	RmiProxyFactoryBean rmiProxy = new RmiProxyFactoryBean();
	rmiProxy.setServiceUrl(rmiUrl + "/CategoryService");
	rmiProxy.setServiceInterface(CategoryService.class);
	return rmiProxy;
}
 
Example 8
Source File: BusinessRmiContext.java    From OpERP with MIT License 5 votes vote down vote up
@Bean
public RmiProxyFactoryBean purchaseService() {
	RmiProxyFactoryBean rmiProxy = new RmiProxyFactoryBean();
	rmiProxy.setServiceInterface(PurchaseService.class);
	String serviceName = rmiProxy.getServiceInterface().getCanonicalName();
	rmiProxy.setServiceUrl(rmiUrl + "/" + serviceName);
	return rmiProxy;
}
 
Example 9
Source File: BusinessRmiContext.java    From OpERP with MIT License 5 votes vote down vote up
@Bean
public RmiProxyFactoryBean saleService() {
	RmiProxyFactoryBean rmiProxy = new RmiProxyFactoryBean();
	rmiProxy.setServiceInterface(SaleService.class);
	String serviceName = rmiProxy.getServiceInterface().getCanonicalName();
	rmiProxy.setServiceUrl(rmiUrl + "/" + serviceName);
	return rmiProxy;
}
 
Example 10
Source File: PartyRmiContext.java    From OpERP with MIT License 5 votes vote down vote up
@Bean
public RmiProxyFactoryBean customerService() {
	RmiProxyFactoryBean rmiProxy = new RmiProxyFactoryBean();
	rmiProxy.setServiceUrl(rmiUrl + "/CustomerService");
	rmiProxy.setServiceInterface(CustomerService.class);
	return rmiProxy;
}
 
Example 11
Source File: PartyRmiContext.java    From OpERP with MIT License 5 votes vote down vote up
@Bean
public RmiProxyFactoryBean vendorService() {
	RmiProxyFactoryBean rmiProxy = new RmiProxyFactoryBean();
	rmiProxy.setServiceUrl(rmiUrl + "/VendorService");
	rmiProxy.setServiceInterface(VendorService.class);
	return rmiProxy;
}
 
Example 12
Source File: StockRmiContext.java    From OpERP with MIT License 5 votes vote down vote up
@Bean
public RmiProxyFactoryBean stockKeeperService() {
	RmiProxyFactoryBean rmiProxy = new RmiProxyFactoryBean();
	rmiProxy.setServiceUrl(rmiUrl + "/StockKeeperService");
	rmiProxy.setServiceInterface(StockKeeperService.class);
	return rmiProxy;
}
 
Example 13
Source File: ItemRmiContext.java    From OpERP with MIT License 5 votes vote down vote up
@Bean
public RmiProxyFactoryBean manufacturerService() {
	RmiProxyFactoryBean rmiProxy = new RmiProxyFactoryBean();
	rmiProxy.setServiceUrl(rmiUrl + "/ManufacturerService");
	rmiProxy.setServiceInterface(ManufacturerService.class);
	return rmiProxy;
}
 
Example 14
Source File: ItemRmiContext.java    From OpERP with MIT License 5 votes vote down vote up
@Bean
public RmiProxyFactoryBean brandService() {
	RmiProxyFactoryBean rmiProxy = new RmiProxyFactoryBean();
	rmiProxy.setServiceUrl(rmiUrl + "/BrandService");
	rmiProxy.setServiceInterface(BrandService.class);
	return rmiProxy;
}
 
Example 15
Source File: RmiProtocol.java    From dubbox with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
protected <T> T doRefer(final Class<T> serviceType, final URL url) throws RpcException {
    final RmiProxyFactoryBean rmiProxyFactoryBean = new RmiProxyFactoryBean();
    rmiProxyFactoryBean.setServiceUrl(url.toIdentityString());
    rmiProxyFactoryBean.setServiceInterface(serviceType);
    rmiProxyFactoryBean.setCacheStub(true);
    rmiProxyFactoryBean.setLookupStubOnStartup(true);
    rmiProxyFactoryBean.setRefreshStubOnConnectFailure(true);
    rmiProxyFactoryBean.afterPropertiesSet();
    return (T) rmiProxyFactoryBean.getObject();
}
 
Example 16
Source File: RmiProtocol.java    From dubbox-hystrix with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
protected <T> T doRefer(final Class<T> serviceType, final URL url) throws RpcException {
    final RmiProxyFactoryBean rmiProxyFactoryBean = new RmiProxyFactoryBean();
    rmiProxyFactoryBean.setServiceUrl(url.toIdentityString());
    rmiProxyFactoryBean.setServiceInterface(serviceType);
    rmiProxyFactoryBean.setCacheStub(true);
    rmiProxyFactoryBean.setLookupStubOnStartup(true);
    rmiProxyFactoryBean.setRefreshStubOnConnectFailure(true);
    rmiProxyFactoryBean.afterPropertiesSet();
    return (T) rmiProxyFactoryBean.getObject();
}
 
Example 17
Source File: RmiProtocol.java    From dubbox with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
protected <T> T doRefer(final Class<T> serviceType, final URL url) throws RpcException {
    final RmiProxyFactoryBean rmiProxyFactoryBean = new RmiProxyFactoryBean();
    rmiProxyFactoryBean.setServiceUrl(url.toIdentityString());
    rmiProxyFactoryBean.setServiceInterface(serviceType);
    rmiProxyFactoryBean.setCacheStub(true);
    rmiProxyFactoryBean.setLookupStubOnStartup(true);
    rmiProxyFactoryBean.setRefreshStubOnConnectFailure(true);
    rmiProxyFactoryBean.afterPropertiesSet();
    return (T) rmiProxyFactoryBean.getObject();
}
 
Example 18
Source File: RmiClientConfig.java    From Spring with Apache License 2.0 5 votes vote down vote up
@Bean
public UserService userService() {
    final RmiProxyFactoryBean factoryBean = new RmiProxyFactoryBean();
    factoryBean.setServiceInterface(UserService.class);
    factoryBean.setServiceUrl("rmi://localhost:1099/userService");
    factoryBean.afterPropertiesSet();
    return (UserService) factoryBean.getObject();
}
 
Example 19
Source File: RmiClientConfig.java    From Spring with Apache License 2.0 5 votes vote down vote up
@Bean
public UserService userService() {
    final RmiProxyFactoryBean factoryBean = new RmiProxyFactoryBean();
    factoryBean.setServiceInterface(UserService.class);
    factoryBean.setServiceUrl("rmi://localhost:1098/userService");
    factoryBean.afterPropertiesSet();
    return (UserService) factoryBean.getObject();
}
 
Example 20
Source File: RmiClient.java    From tutorials with MIT License 4 votes vote down vote up
@Bean RmiProxyFactoryBean service() {
    RmiProxyFactoryBean rmiProxyFactory = new RmiProxyFactoryBean();
    rmiProxyFactory.setServiceUrl("rmi://localhost:1099/CabBookingService");
    rmiProxyFactory.setServiceInterface(CabBookingService.class);
    return rmiProxyFactory;
}