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,