/** * Sets the ActuateServerURL * * @param serverURL The actuate server url to set */ public void setActuateServerURL(String serverURL) throws MalformedURLException, ServiceException { if ((proxy == null) || !serverURL.equals(actuateServerURL)) { if (serverURL != null) actuateServerURL = serverURL; System.out.println("Setting server to " + actuateServerURL); proxy = (ActuateSoapBindingStub) actuateAPI.getActuateSoapPort(new java.net.URL(actuateServerURL)); } }
/** * Login to actuate server with username and password to targetVolume Return true if login success */ public boolean login() { boolean success = true; com.actuate.schemas.Login request = new com.actuate.schemas.Login(); request.setPassword(password); request.setUser(username); try { actuateAPI.setAuthId(null); System.out.println("Setting TargetVolume to " + targetVolume); actuateAPI.setTargetVolume(targetVolume); com.actuate.schemas.LoginResponse response = proxy.login(request); authenticationId = response.getAuthId(); actuateAPI.setAuthId(authenticationId); } catch (java.rmi.RemoteException e) { // login failed success = false; } return success; }
/** * Select a single page and save the result in the specified directory * * @param FileName * @param format * @param pageNumber * @param downloadDirectory * @return String the first file attachment name * @throws RemoteException */ public String selectPage(String FileName, String format, int pageNumber, String downloadDirectory) throws RemoteException { // Set view parameter com.actuate.schemas.ViewParameter viewParameter = new com.actuate.schemas.ViewParameter(); viewParameter.setFormat(format); viewParameter.setUserAgent( "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; Q312461; .NET CLR 1.0.3705)"); // Set file name to view com.actuate.schemas.ObjectIdentifier objectIdentifier = new com.actuate.schemas.ObjectIdentifier(); objectIdentifier.setName(FileName); // Set the pages to view com.actuate.schemas.PageIdentifier pageIdentifier = new com.actuate.schemas.PageIdentifier(); pageIdentifier.setPageNum(new Long(pageNumber)); // Set the select page request com.actuate.schemas.SelectPage selectPage = new com.actuate.schemas.SelectPage(); selectPage.setObject(objectIdentifier); selectPage.setViewParameter(viewParameter); selectPage.setPage(pageIdentifier); selectPage.setDownloadEmbedded(new Boolean(true)); // Set FileType actuateAPI.setFileType(FileName.split("\\.")[1]); // SelectPage com.actuate.schemas.SelectPageResponse selectPageResponse = proxy.selectPage(selectPage); // Save the result in download directory new File(downloadDirectory).mkdir(); String firstAttachmentName = saveAttachment(selectPageResponse.getPageRef(), downloadDirectory); saveAttachment(selectPageResponse.getPostResponseRef(), downloadDirectory); return firstAttachmentName; }
/** @param string */ public void setConnectionHandle(String string) { actuateAPI.setConnectionHandle(string); }
/** @return */ public String getConnectionHandle() { return actuateAPI.getConnectionHandle(); }
/** * Create a new call object that can be used to send SOAP message to actuate server * * @return Call * @throws ServiceException */ public org.apache.axis.client.Call createCall() throws ServiceException { org.apache.axis.client.Call call = (org.apache.axis.client.Call) actuateAPI.createCall(); call.setTargetEndpointAddress(this.actuateServerURL); return call; }