Package com.adito.tunnels

Examples of com.adito.tunnels.Tunnel


     * @see com.adito.policyframework.actions.AbstractResourceDispatchAction#commitCreatedResource(org.apache.struts.action.ActionMapping, com.adito.policyframework.forms.AbstractResourceForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
     */
    protected Resource commitCreatedResource(ActionMapping mapping, AbstractResourceForm form, HttpServletRequest request,
                                             HttpServletResponse response) throws Exception {
        TunnelForm tf = (TunnelForm) form;
        Tunnel tunnel = (Tunnel) tf.getResource();

        return TunnelDatabaseFactory.getInstance().createTunnel(tunnel.getRealmID(), tunnel.getResourceName(),
            tunnel.getResourceDescription(), tunnel.getType(), tunnel.isAutoStart(), tunnel.getTransport(), tunnel.getUsername(),
            tunnel.getSourcePort(), tunnel.getDestination(), tunnel.getSourceInterface());
    }
View Full Code Here


        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"));
View Full Code Here

     *      boolean)
     */
    public void initialise(HttpServletRequest request, Resource resource, boolean editing, MultiSelectSelectionModel policyModel,
                           PropertyList selectedPolicies, User owner, boolean assignOnly) throws Exception {
        super.initialise(request, resource, editing, policyModel, selectedPolicies, owner, assignOnly);
        Tunnel tunnel = (Tunnel) resource;
        sourcePort = String.valueOf(tunnel.getSourcePort());
        destinationHost = tunnel.getDestination().getHost();
        destinationPort = String.valueOf(tunnel.getDestination().getPort());
        tunnelType = tunnel.getType();
        transport = tunnel.getTransport();
        autoStart = tunnel.isAutoStart();
        sourceInterface = tunnel.getSourceInterface();
    }
View Full Code Here

     * (non-Javadoc)
     *
     * @see com.adito.policyframework.forms.AbstractResourceForm#applyToResource()
     */
    public void applyToResource() throws Exception {
        Tunnel tunnel = (Tunnel) getResource();
        tunnel.setType(getTunnelType());
        tunnel.setAutoStart(isAutoStart());
        tunnel.setTransport(getTransport());
        tunnel.setSourcePort(Integer.parseInt(getSourcePort()));
        tunnel.setDestination(new HostService(getDestinationHost(), Integer.parseInt(getDestinationPort())));
        tunnel.setSourceInterface(getSourceInterface());
    }
View Full Code Here

        if (DefaultAgentManager.getInstance().hasActiveAgent(session)) {
            Set activeTunnels = ((TunnelingService) DefaultAgentManager.getInstance().getService(TunnelingService.class))
                            .getActiveTunnels(session);
            for (Iterator it = tunnels.iterator(); it.hasNext();) {
                Tunnel tunnel = (Tunnel) it.next();
                if (tunnel != null && tunnel.getResourceId() >= 0) {
                    Integer id = new Integer(tunnel.getResourceId());
                    LaunchSession launchSession = activeTunnels.contains(id) ? LaunchSessionFactory.getInstance()
                                    .getFirstLaunchSessionForResource(session, tunnel) : null;
                    TunnelItem ti = new TunnelItem(tunnel, PolicyDatabaseFactory.getInstance().getPoliciesAttachedToResource(
                                    tunnel, user.getRealm()), launchSession);
                    ti.setFavoriteType(getFavoriteType(tunnel.getResourceId()));
                    getModel().addItem(ti);
                }
            }
        } else {
            Iterator i = tunnels.iterator();
            while (i.hasNext()) {
                Tunnel tunnel = (Tunnel) i.next();
                if (tunnel != null) {
                    TunnelItem ti = new TunnelItem(tunnel, PolicyDatabaseFactory.getInstance().getPoliciesAttachedToResource(
                                    tunnel, user.getRealm()), null);
                    ti.setFavoriteType(getFavoriteType(ti.getTunnel().getResourceId()));
                    getModel().addItem(ti);
View Full Code Here

TOP

Related Classes of com.adito.tunnels.Tunnel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.