Examples of Route


Examples of org.midonet.client.resource.Route

                        Integer cnt = ipRuleCounts.get(ip);
                        if (cnt != null) {
                            if (cnt == 1) {
                                ipRuleCounts.remove(ip);
                                // no more rules for this IP. delete the route.
                                Route route = routes.remove(ip);
                                route.delete();
                            } else {
                                ipRuleCounts.put(ip, new Integer(ipRuleCounts.get(ip).intValue() - 1));
                            }
                        }
                        foundPreNatRule.delete();
                    }
                }
            } else if (rule.getState() == FirewallRule.State.Add) {
                for(int i = 0; i < ruleStrings.length; i++){
                    String ruleString = ruleStrings[i];
                    Rule foundRule = existingPreNatRules.get(ruleString);
                    if(foundRule == null){

                        String vmIp = ruleTO.getDstIp();
                        String publicIp = dstIp.getAddress().addr();
                        int privPortStart = ruleTO.getDstPortRange()[0];
                        int privPortEnd = ruleTO.getDstPortRange()[1];
                        int pubPortStart = ruleTO.getSrcPortRange()[0];
                        int pubPortEnd = ruleTO.getSrcPortRange()[1];

                        DtoRule.DtoNatTarget[] preTargets = new DtoRule.DtoNatTarget[]{
                            new DtoRule.DtoNatTarget(vmIp, vmIp, privPortStart, privPortEnd)};

                        Rule preNatRule = preNat.addRule()
                            .type(DtoRule.DNAT)
                            .flowAction(DtoRule.Accept)
                            .nwDstAddress(publicIp)
                            .nwDstLength(32)
                            .tpDst(new DtoRange(pubPortStart, pubPortEnd))
                            .natTargets(preTargets)
                            .nwProto(SimpleFirewallRule.stringToProtocolNumber(rule.getProtocol()))
                            .position(1);

                        Integer cnt = ipRuleCounts.get(publicIp);
                        if (cnt != null) {
                            ipRuleCounts.put(publicIp, new Integer(cnt.intValue() + 1));
                        } else {
                            ipRuleCounts.put(publicIp, new Integer(1));
                        }
                        String preNatRuleStr = new SimpleFirewallRule(preNatRule).toStringArray()[0];
                        existingPreNatRules.put(preNatRuleStr, preNatRule);
                        preNatRule.create();

                        if (routes.get(publicIp) == null) {
                            Route route = providerRouter.addRoute()
                                            .type("Normal")
                                            .weight(100)
                                            .srcNetworkAddr("0.0.0.0")
                                            .srcNetworkLength(0)
                                            .dstNetworkAddr(publicIp)
                                            .dstNetworkLength(32)
                                            .nextHopPort(providerDownlink.getId());
                            route.create();
                            routes.put(publicIp, route);
                        }

                        // If Firewall is in our service offering, set up the
                        // default firewall rule
View Full Code Here

Examples of org.movsim.simulator.roadnetwork.routing.Route

    }

    private Vehicle createVehicle(MicroInflowRecord record) {
        final Vehicle vehicle = trafficSource.vehGenerator.createVehicle(record.getTypeLabel());
        if (record.hasRouteOrDestination()) {
            Route route = routing.hasRoute(record.getRouteOrDestination()) ? routing
                    .get(record.getRouteOrDestination()) : routing.findRoute(trafficSource.roadSegment.userId(),
                    record.getRouteOrDestination());
            LOG.info("overwrites vehicle's default route by route provided by input file: route={}", route.getName());
            vehicle.setRoute(route);
        }
        if (record.hasComment()) {
            vehicle.setInfoComment(record.getComment());
        }
View Full Code Here

Examples of org.onebusaway.gtfs.model.Route

    return metadata;
  }

  private Route getRouteForJourney(JourneyHeaderElement journey) {
    AgencyAndId routeId = getRouteIdForJourney(journey);
    Route route = _dao.getRouteForId(routeId);
    if (route == null) {
      route = new Route();
      route.setAgency(getAgencyForId(routeId.getAgencyId()));
      route.setId(routeId);
      route.setShortName(journey.getRouteIdentifier());
      route.setType(getRouteTypeForJourney(journey));
      RouteMetadata metaData = _routeMetadataById.get(routeId);
      if (metaData != null) {
        for (String id : _preferredDirectionIdsForRouteDetails) {
          String longName = metaData.getRouteLongNameForDirectionId(id);
          if (longName != null) {
            route.setLongName(longName);
            break;
          }
        }
        for (String id : _preferredDirectionIdsForRouteDetails) {
          String routeUrl = metaData.getRouteUrlForDirectionId(id);
          if (routeUrl != null) {
            route.setUrl(routeUrl);
            break;
          }
        }
      }
      _dao.saveEntity(route);
View Full Code Here

Examples of org.restlet.Route

                        } else {
                            offsetPath = uriPattern;
                        }

                        // Shift the default route (if any) of the default host
                        Route defaultRoute = component.getDefaultHost()
                                .getDefaultRoute();
                        if (defaultRoute != null) {
                            defaultRoute.getTemplate().setPattern(
                                    offsetPath
                                            + defaultRoute.getTemplate()
                                                    .getPattern());
                            log("[Noelios Restlet Engine] - Attaching restlet: "
                                    + defaultRoute.getNext()
                                    + " to URI: "
                                    + offsetPath
                                    + defaultRoute.getTemplate().getPattern());
                        }

                        // Shift the routes of the default host
                        for (final Route route : component.getDefaultHost()
                                .getRoutes()) {
                            log("[Noelios Restlet Engine] - Attaching restlet: "
                                    + route.getNext()
                                    + " to URI: "
                                    + offsetPath
                                    + route.getTemplate().getPattern());
                            route.getTemplate().setPattern(
                                    offsetPath
                                            + route.getTemplate().getPattern());
                        }
                        for (final VirtualHost virtualHost : component
                                .getHosts()) {
                            // Shift the default route (if any) of the virtual
                            // host
                            defaultRoute = virtualHost.getDefaultRoute();
                            if (defaultRoute != null) {
                                defaultRoute.getTemplate().setPattern(
                                        offsetPath
                                                + defaultRoute.getTemplate()
                                                        .getPattern());
                                log("[Noelios Restlet Engine] - Attaching restlet: "
                                        + defaultRoute.getNext()
                                        + " to URI: "
                                        + offsetPath
                                        + defaultRoute.getTemplate()
                                                .getPattern());
                            }
                            // Shift the routes of the virtual host
                            for (final Route route : virtualHost.getRoutes()) {
                                log("[Noelios Restlet Engine] - Attaching restlet: "
View Full Code Here

Examples of org.restlet.routing.Route

     * @param requiredScore
     *            The minimum score required to have a match.
     * @return The best route match or null.
     */
    public Route getBest(Request request, Response response, float requiredScore) {
        Route result = null;
        float bestScore = 0F;
        float score;

        for (Route current : this) {
            score = current.score(request, response);
View Full Code Here

Examples of org.rsbot.script.web.Route

    if (routes.size() > 0) {
      if (Web.rs_map.size() != oldCount) {
        oldCount = Web.rs_map.size();
        update();
      }
      Route route = routes.poll();
      if (route.execute()) {
        if (!route.finished()) {
          routes.addFirst(route);
        }
        return true;
      } else {
        return false;
View Full Code Here

Examples of org.sonatype.nexus.componentviews.Router.Route

  private final ViewConfig config;

  public View(final ViewConfig config, final Router router, final Handler handlerOfLastResort) {
    this.router = checkNotNull(router);
    this.config = checkNotNull(config);
    this.routeOfLastResort = new Route(new AllRequestMatcher(), asList(handlerOfLastResort));
  }
View Full Code Here

Examples of org.wso2.carbon.mediators.router.impl.Route

            OMAttribute expressionAttr = routeElement.getAttribute(ATT_EXPRN);
            OMAttribute matchAttr = routeElement.getAttribute(ATT_MATCH);
            OMAttribute breakRouterAttr = routeElement.getAttribute(ATT_BREAK_ROUTER);
            OMElement targetElem = routeElement.getFirstChildWithName(TARGET_Q);

            Route route = new Route();

            if (expressionAttr != null && expressionAttr.getAttributeValue() != null) {

                try {
                    route.setExpression(
                        SynapseXPathFactory.getSynapseXPath(routeElement, ATT_EXPRN));
                } catch (JaxenException e) {
                    handleException("Couldn't build the xpath from the expression : "
                        + expressionAttr.getAttributeValue(), e);
                }
            } else {

                handleException("Route without an expression attribute has been found, " +
                    "but it is required to have an expression for all routes");
            }

            if (matchAttr != null && matchAttr.getAttributeValue() != null) {
                route.setMatch(Pattern.compile(matchAttr.getAttributeValue()));
            }

            if (breakRouterAttr != null && breakRouterAttr.getAttributeValue() != null) {
                route.setBreakRouter(Boolean.parseBoolean(breakRouterAttr.getAttributeValue()));
            }

            if (targetElem != null) {

                route.setTarget(TargetFactory.createTarget(targetElem, properties));

            } else {
                handleException("Route has to have a target for it, " +
                    "missing the taregt of the route");
            }
View Full Code Here

Examples of play.mvc.Router.Route

      this.lastApplicationClassloaderState = Play.classloader.currentState;
    }

    // copy fixed routes from the old route
    for (Iterator<Route> iterator = oldRoutes.iterator(); iterator.hasNext();) {
      Route r = iterator.next();
      if (r.routesFileLine != RouterMethod.AUTO_ROUTE_LINE) {
        newRoutes.add(r);
      }
    }
    Router.routes = newRoutes;
View Full Code Here

Examples of play.mvc.Router.Route

    if (httpMethodAnnotations.size() == 0) {
      if (autoRouting) {
        // automatically added a special post for POST
        // no params on path
        if (paramNames.length() > 0) {
          Route r = new Route();
          r.method = "POST";
          r.path = pathSpec; // no params, no post-fix.
          r.action = act;
          r.routesFile = "_autopath";
          r.routesFileLine = AUTO_ROUTE_LINE;
          r.compute();
          routes.add(r);
        }
        // the catch other
        Route r = new Route();
        r.method = "*";
        r.path = pathSpec + paramNames + pathEnding;
        r.action = act;
        r.routesFile = "_autopath";
        r.routesFileLine = AUTO_ROUTE_LINE;
        r.compute();
        routes.add(r);
      } else {
        Route r = new Route();
        r.method = "*";
        r.path = pathSpec;
        r.action = act;
        r.routesFile = "_autopath";
        r.routesFileLine = AUTO_ROUTE_LINE;
        r.compute();
        routes.add(r);
      }
    } else {
      for (Annotation an : httpMethodAnnotations) {
        Route r = new Route();
        r.method = an.annotationType().getSimpleName();
        r.action = act;
        r.routesFile = "_autopath";
        r.routesFileLine = AUTO_ROUTE_LINE;
        if (!autoRouting || an instanceof POST) {
          r.path = pathSpec;
        } else {
          r.path = pathSpec + paramNames + pathEnding;
        }
        r.compute();
        routes.add(r);
      }
    }

    pathSpecPattern = Pattern.compile(pathSpec.replaceAll(RouterClass.urlParamCapture, "\\\\{(.*)\\\\}"));
 
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.