Package jnode.dto

Examples of jnode.dto.Link


  private static final ConcurrentDateFormatAccess format = new ConcurrentDateFormatAccess(
      "dd.MM.yyyy HH:mm");

  @Override
  public void execute(FtnMessage fmsg) throws Exception {
    Link link = getAndCheckLink(fmsg);
    if (link == null) {
      return;
    }

        // если скрипт - то фигарим скрипт
View Full Code Here


        route.setFromAddr(fa);
        route.setFromName(fn);
        route.setToAddr(ta);
        route.setToName(tn);
        route.setSubject(s);
        Link l = ORMManager.get(Link.class).getById(Long.valueOf(v));
        if (l != null) {
          route.setRouteVia(l);
          ORMManager.get(jnode.dto.Route.class).save(route);
        }
      } catch (RuntimeException e) {
View Full Code Here

    StringBuilder sb = new StringBuilder();
    String id = req.queryParams("id");
    if (id != null) {
      try {
        Long lid = Long.valueOf(id);
        Link link = ORMManager.get(Link.class).getById(lid);
        if (link != null) {
          List<LinkOption> options = ORMManager.get(LinkOption.class)
              .getAnd("link_id", "=", link);
          sb.append(JSONUtil.value(options));
        }
View Full Code Here

        String cb = req.queryParams("cb");
        if (cb != null) {
          sb.append(cb + "(");
        }
        Long lid = Long.valueOf(id);
        Link l = ORMManager.get(Link.class).getById(lid);
        sb.append(JSONUtil.value(l));
        if (cb != null) {
          sb.append(")");
        }
        resp.type("text/javascript");
View Full Code Here

    if (!MainHandler.getCurrentInstance().getBooleanProperty(BINKD_CLIENT,
        true)) {
      return;
    }
    while (true) {
      Link l = null;
      synchronized (PollQueue.getSelf()) {
        if (PollQueue.getSelf().isEmpty()) {
          try {
            PollQueue.getSelf().wait();
          } catch (InterruptedException e) {
          }
        }
        l = PollQueue.getSelf().getNext();
      }
      try {
        BinkpAbstractConnector conn = null;
        String pa = l.getProtocolAddress();
        for (String key : BinkpConnectorRegistry.getSelf().getKeys()) {
          if (l.getProtocolAddress().startsWith(key)) {
            conn = createConnector(pa, key);
            break;
          }
        }
        if (conn == null) {
          conn = new BinkpAsyncConnector(l.getProtocolAddress());
        }
        ThreadPool.execute(conn);
      } catch (RuntimeException e) {
        logger.l2("Runtime exception: " + e.getLocalizedMessage(), e);
      } catch (IOException e) {
View Full Code Here

      String id = req.queryParams("id");
      try {
        LinkRequest lr = ORMManager.get(LinkRequest.class).getById(id);
        if (lr != null && lr.getAkey().equals(akey)) { // valid
          String password = FtnTools.generate8d();
          Link link = new Link();
          link.setLinkName(lr.getName());
          link.setLinkAddress(lr.getAddress());
          link.setProtocolHost(lr.getHost());
          link.setProtocolPort(lr.getPort());
          link.setPaketPassword(password);
          link.setProtocolPassword(password);
          // check
          synchronized (Link.class) {
            Link l2 = ORMManager.get(Link.class).getFirstAnd(
                "ftn_address", "=", link.getLinkAddress());
            if (l2 == null) {
              writeGreets(link);
              ORMManager.get(Link.class).save(link);
              ORMManager.get(LinkRequest.class).delete(lr);
View Full Code Here

  public Object handle(Request req, Response resp) {
    List<Route> routes = ORMManager.get(Route.class).getOrderAnd("nice",
        true);
    StringBuilder sb = new StringBuilder();
    for (Route r : routes) {
      Link l = ORMManager.get(Link.class)
          .getById(r.getRouteVia().getId());
      sb.append(String
          .format("<tr><td>%d</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td><a href=\"#\" class=\"css-link-1\" onclick=\"del(%d);\">Удалить</a></td></tr>",
              r.getNice(), r.getFromAddr(), r.getFromName(),
              r.getToAddr(), r.getToName(), r.getSubject(),
              (l != null) ? l.getLinkAddress() : "NULL",
              r.getId()));
    }
    StringBuilder sb2 = new StringBuilder();
    for (Link l : ORMManager.get(Link.class).getAll()) {
      if (l.getLinkAddress().matches(
          "^[1-7]:[0-9]{1,5}\\/[0-9]{1,5}(\\.0)?$")) {
        sb2.append("<option value=\"" + l.getId() + "\">"
            + l.getLinkAddress() + "</option>");
      }
    }
    return HTML.start(true)
        .append(String.format(routings, sb.toString(), sb2.toString()))
        .footer().get();
View Full Code Here

            throw new UnknownCommandException();
        }

        String pass = params.iterator().next();

        Link link = dataProvider.link(auth, pass);

        Collection<String> response = Lists.newLinkedList();

        if (link == null) {
            response.add(NntpResponse.AuthInfo.AUTHENTIFICATION_FAILED_OR_REJECTED);
            auth.reset();
        } else {
            auth.setLinkId(link.getId());
            response.add(NntpResponse.AuthInfo.AUTHENTIFICATION_ACCEPTED);
        }

        return response;
    }
View Full Code Here

  private List<String> listRouting(String via, int limit) {
    List<Route> routing = null;
    GenericDAO<Route> routeDao = ORMManager.get(Route.class);
    GenericDAO<Link> linkDAO = ORMManager.get(Link.class);
    if (via != null) {
      Link link = linkDAO.getFirstAnd("ftn_address", "eq", via);
      routing = (limit != 0) ? routeDao.getOrderLimitAnd(limit, "nice",
          true, "route_via", "eq", link) : routeDao.getOrderAnd(
          "nice", true, "route_via", "eq", link);

    } else {
View Full Code Here

    GenericDAO<Link> linkDAO = ORMManager.get(Link.class);
    GenericDAO<Echoarea> echoDAO = ORMManager.get(Echoarea.class);
    GenericDAO<Subscription> subDAO = ORMManager.get(Subscription.class);
    List<Object> va_args = new ArrayList<>();
    if (ftn != null) {
      Link link = linkDAO.getFirstAnd("ftn_address", "eq", ftn);
      va_args.add("link_id");
      va_args.add("eq");
      va_args.add(link);
    }
View Full Code Here

TOP

Related Classes of jnode.dto.Link

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.