int sourcePort = ((Integer) seq.getAttribute(TunnelDetailsForm.ATTR_SOURCE_PORT, null)).intValue();
String destinationHost = (String) seq.getAttribute(TunnelDetailsForm.ATTR_DESTINATION_HOST, null);
int destinationPort = ((Integer) seq.getAttribute(TunnelDetailsForm.ATTR_DESTINATION_PORT, null)).intValue();
String sourceInterface = ((String) seq.getAttribute(TunnelDetailsForm.ATTR_SOURCE_INTERFACE, null));
boolean autoStart = ((Boolean) seq.getAttribute(TunnelDetailsForm.ATTR_AUTO_START, null)).booleanValue();
Tunnel tunnel = null;
try {
try {
tunnel = TunnelDatabaseFactory.getInstance().createTunnel(user.getRealm().getRealmID(), name, description, type, autoStart, transport,
user.getPrincipalName(), sourcePort, new HostService(destinationHost, destinationPort),
sourceInterface);
CoreServlet.getServlet().fireCoreEvent(
new CoreEvent(this, TunnelsEventConstants.CREATE_TUNNEL, null, info, CoreEvent.STATE_SUCCESSFUL)
.addAttribute(CoreAttributeConstants.EVENT_ATTR_RESOURCE_NAME, name)
.addAttribute(CoreAttributeConstants.EVENT_ATTR_RESOURCE_DESCRIPTION, description)
.addAttribute(TunnelsEventConstants.EVENT_ATTR_TUNNEL_SOURCE_PORT,
Integer.toString(sourcePort)).addAttribute(
TunnelsEventConstants.EVENT_ATTR_TUNNEL_DESTINATION,
String.valueOf(destinationHost + ":" + destinationPort))
.addAttribute(TunnelsEventConstants.EVENT_ATTR_TUNNEL_TRANSPORT, transport)
.addAttribute(
TunnelsEventConstants.EVENT_ATTR_TUNNEL_TYPE,
((LabelValueBean) TransportType.TYPES.get(tunnel.getType()))
.getLabel()));
} catch (Exception e) {
CoreServlet.getServlet().fireCoreEvent(
new CoreEvent(this, TunnelsEventConstants.CREATE_TUNNEL, null, info, CoreEvent.STATE_UNSUCCESSFUL)
.addAttribute(CoreAttributeConstants.EVENT_ATTR_RESOURCE_NAME, name)
.addAttribute(CoreAttributeConstants.EVENT_ATTR_RESOURCE_DESCRIPTION, description)
.addAttribute(TunnelsEventConstants.EVENT_ATTR_TUNNEL_SOURCE_PORT,
Integer.toString(sourcePort)).addAttribute(
TunnelsEventConstants.EVENT_ATTR_TUNNEL_DESTINATION,
String.valueOf(destinationHost + ":" + destinationPort))
.addAttribute(TunnelsEventConstants.EVENT_ATTR_TUNNEL_TRANSPORT, transport)
.addAttribute(
TunnelsEventConstants.EVENT_ATTR_TUNNEL_TYPE,
((LabelValueBean) TransportType.TYPES.get(tunnel.getType()))
.getLabel()));
throw e;
}
actionStatus.add(new WizardActionStatus(WizardActionStatus.COMPLETED_OK,
"tunnelWizard.tunnelFinish.status.profileCreated"));