ClientProxyFactoryUtils.java 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package com.kingdee.eas.custom.shuiyou.utils;
  2. import cn.com.servyou.rmi.client.ClientProxyFactory;
  3. import com.kingdee.bos.BOSException;
  4. import com.kingdee.util.StringUtils;
  5. import java.io.FileInputStream;
  6. import java.io.IOException;
  7. import java.util.Properties;
  8. /**
  9. * @Description TODO
  10. * @Date 2024/9/11 16:38
  11. * @Created by Heyuan
  12. */
  13. public class ClientProxyFactoryUtils {
  14. /**
  15. * 获取客户端代理工厂
  16. *
  17. * @return
  18. * @throws IOException
  19. * @throws BOSException
  20. */
  21. public static ClientProxyFactory getClientProxyFactory() throws IOException, BOSException {
  22. StringBuilder errorMsg = new StringBuilder();
  23. Properties properties = new Properties();
  24. properties.load(new FileInputStream(System.getProperty("EAS_HOME") + "/server/properties/sy/syConfig.properties"));
  25. String ip = properties.getProperty("ip");
  26. if (StringUtils.isEmpty(ip)) {
  27. errorMsg.append("接口ip不能为空,请检查配置文件/server/properties/sy/syConfig.properties\n");
  28. }
  29. String appKey = properties.getProperty("appKey");
  30. if (StringUtils.isEmpty(appKey)) {
  31. errorMsg.append("接口appKey不能为空,请检查配置文件/server/properties/sy/syConfig.properties\n");
  32. }
  33. String appSecret = properties.getProperty("appSecret");
  34. if (StringUtils.isEmpty(appSecret)) {
  35. errorMsg.append("接口appSecret不能为空,请检查配置文件/server/properties/sy/syConfig.properties\n");
  36. }
  37. if (errorMsg.length() > 0) {
  38. throw new BOSException(errorMsg.toString());
  39. }
  40. //客户端代理工厂
  41. return new ClientProxyFactory(appKey, appSecret, ip);
  42. }
  43. }