protected AsyncTurmericRSV1 getProxy() throws ServiceException { if (m_proxy == null) { String svcAdminName = RepositoryServiceClientConstants.SERVICE_NAME; Service service = ServiceFactory.create(svcAdminName, RepositoryServiceClientConstants.SERVICE_NAME); service.setSessionTransportHeader( "X-TURMERIC-SECURITY-USERID", RepositoryServiceClientConstants.USER_ID); service.setSessionTransportHeader( "X-TURMERIC-SECURITY-PASSWORD", RepositoryServiceClientConstants.USER_PASSWORD); m_proxy = service.getProxy(); } return m_proxy; }
/** * Fetch the CachePolicy from the server, it is marked as protected for testability. * * @param serviceId Service Id * @param serviceURL Servicew end point. * @return A InputStream to read the CachePolicy. * @throws ServiceException Exception when initialization fails. */ protected InputStream fetchCachePolicy(ClientServiceId serviceId, URL serviceURL) throws ServiceException { Preconditions.checkNotNull(serviceId); Preconditions.checkNotNull(serviceURL); Service service = ServiceFactory.create( serviceId.getAdminName(), serviceId.getEnvName(), serviceId.getClientName(), serviceURL); List<Object> outParams = new ArrayList<Object>(); service.invoke(SOAConstants.OP_GET_CACHE_POLICY, null, outParams); String cachePolicyStr = outParams.size() > 0 ? (String) outParams.get(0) : null; throwErrorOnNull(cachePolicyStr); InputStream in = convertToInputStream(cachePolicyStr); return in; }