/** @return String */ public String actionRegister() { final String methodName = "actionRegister"; Logfile.WriteCalled(logLevel, STR_ClassName, methodName); /* * Parse the web page information */ ProcessAgentInfo processAgentInfo = this.Parse(null); if (processAgentInfo != null) { try { /* * Get self information */ ProcessAgents processAgents = this.serviceBrokerSession.getServiceManagement().getProcessAgents(); ProcessAgent selfProcessAgent = processAgents.RetrieveSelf(); /* * Create coupons for the ProcessAgent */ TicketIssuer ticketIssuer = this.serviceBrokerSession.getServiceManagement().getTicketIssuer(); Coupon inCoupon = ticketIssuer.CreateCoupon(); Coupon outCoupon = ticketIssuer.CreateCoupon(); ProcessAgentAPI processAgentAPI = null; try { /* * Pass on to ProcessAgent for processing */ processAgentAPI = new ProcessAgentAPI(processAgentInfo.getServiceUrl()); processAgentAPI.setAuthHeaderInitPasskey(processAgentInfo.getOutCoupon().getPasskey()); ProcessAgent processAgent = processAgentAPI.InstallDomainCredentials(selfProcessAgent, inCoupon, outCoupon); if (processAgent == null) { throw new RuntimeException("InstallDomainCredentials() returned null"); } /* * Create the ProcessAgentInfo for the ProcessAgent */ processAgentInfo.setProcessAgent(processAgent); processAgentInfo.setInCoupon(outCoupon); processAgentInfo.setOutCoupon(inCoupon); processAgentInfo.setIssuerGuid(ticketIssuer.getIssuerGuid()); /* * Create the ProcessAgentInfo */ if (processAgents.Create(processAgentInfo) < 0) { throw new RuntimeException( String.format(STRERR_SaveFailed_arg, processAgentInfo.getAgentName())); } } catch (Exception ex) { /* * Delete the issued coupons */ if (outCoupon != null) { ticketIssuer.DeleteCoupon(outCoupon.getCouponId()); } if (inCoupon != null) { ticketIssuer.DeleteCoupon(inCoupon.getCouponId()); } throw ex; } /* * Register SystemSupportInfo */ SystemSupportInfo systemSupportInfo = processAgents.RetrieveSystemSupportInfoSelf(); if (systemSupportInfo != null) { SystemSupportPayload systemSupportPayload = new SystemSupportPayload(systemSupportInfo); String serviceProviderInfo = systemSupportPayload.ToXmlString(); ServiceDescription[] serviceDescriptions = new ServiceDescription[] { new ServiceDescription( serviceProviderInfo, null, ServiceDescription.STR_RequestSystemSupport) }; processAgentAPI.setAuthHeaderAgentGuid(selfProcessAgent.getAgentGuid()); processAgentAPI.setAuthHeaderCoupon(inCoupon); processAgentAPI.Register(hitServiceGuid, serviceDescriptions); } /* * Refresh the services list and repopulate ProcessAgentInfo information */ this.serviceList = this.CreateServiceList(); this.hsomService = processAgentInfo.getAgentName(); this.PopulateServiceInfo(); /* * Information saved successfully */ this.registered = true; this.ShowMessageInfo( String.format(STR_RegisterSuccessful_arg, processAgentInfo.getAgentName())); } catch (Exception ex) { String message = ex.getMessage(); ShowMessageError(message != null ? message : ex.toString()); Logfile.WriteError(ex.toString()); } } Logfile.WriteCompleted(logLevel, STR_ClassName, methodName); /* Navigate to the current page */ return null; }