Package de.iritgo.aktera.model

Examples of de.iritgo.aktera.model.KeelRequest


  /**
   * @see java.lang.Runnable#run()
   */
  public void run()
  {
    KeelRequest dsreq = new ModelRequestMessage();

    if (! isInitialized())
    {
      try
      {
        keelContainer = getContainer();
        getLogger().info("Started");

        //        String mto = System.getProperty ("model.timeout");
        //
        //        if (mto != null)
        //        {
        //          try
        //          {
        //            int newTimeOut = new Integer(mto).intValue ();
        //            timeout = newTimeOut;
        //          }
        //          catch (Exception e)
        //          {
        //            getLogger ().warn ("Unable to set model timeout to '" + mto + "'");
        //          }
        //        }

        //        int initPoolSize = 1;
        //        int minPoolSize = 1;
        //        int maxPoolSize = Integer.MAX_VALUE;
        //        int keepAliveTime = 60 * 1000;
        //
        //        try
        //        {
        //          minPoolSize = Integer.parseInt (
        //              System.getProperty ("keel.processor.threads.min"));
        //        }
        //        catch (NumberFormatException x)
        //        {
        //        }
        //
        //        try
        //        {
        //          maxPoolSize = Integer.parseInt (
        //              System.getProperty ("keel.processor.threads.max"));
        //        }
        //        catch (NumberFormatException x)
        //        {
        //        }
        //
        //        try
        //        {
        //          initPoolSize = Integer.parseInt (
        //              System.getProperty ("keel.processor.threads.init"));
        //        }
        //        catch (NumberFormatException x)
        //        {
        //        }

        //        pool = new ThreadPoolExecutor(
        //            minPoolSize, maxPoolSize, keepAliveTime, TimeUnit.MILLISECONDS,
        //            new SynchronousQueue());
      }
      catch (Exception ee)
      {
        getLogger().error("Startup error:", ee);
        heldError = ee;
        throw new RuntimeException(LOG_PREFIX + "Startup Error", ee);
      }
    }

    while (keepRunningKeelDirectServer)
    {
      KeelRequest request;

      try
      {
        //There's only one thread taking objects off the requestQueue, so this doesn't need to be synced
        byte[] requestBytes = (byte[]) requestChannel.take();
View Full Code Here


  {
    try
    {
      this.keepRunningKeelDirectServer = false;

      KeelRequest message = new ModelRequestMessage();

      /**
       * Put an empty message on the queue to causes the "infinite" loop to stop.
       */
      byte[] requestBytes = message.serialize();

      requestChannel.put(requestBytes);

      LinkedBlockingQueue replyChannel = new LinkedBlockingQueue();

View Full Code Here

      try
      {
        reader = new ObjectInputStream(new BufferedInputStream(socket.getInputStream()));

        KeelRequest request = (KeelRequest) reader.readObject();

        try
        {
          response = execute(request);
        }
View Full Code Here

   * @return The Keel request
   * @throws ClientException
   */
  protected KeelRequest makeKeelRequest(WebappRequest wreq, String defaultModelName) throws ClientException
  {
    KeelRequest kreq = super.makeKeelRequest(wreq, defaultModelName);

    kreq.setModel(defaultModelName);

    return kreq;
  }
View Full Code Here

    return args;
  }

  public boolean allowed(String resource, String operation)
  {
    KeelRequest keelRequest = new ModelRequestMessage();

    keelRequest.setModel("security.authorization");
    keelRequest.setAttribute("sessionid", hreq.getSession().getId());
    keelRequest.setParameter("component", resource);

    if (operation != null)
    {
      keelRequest.setParameter("operation", operation);
    }

    try
    {
      KeelResponse kres = execute();
View Full Code Here

    return configDir.getCanonicalPath();
  }

  public static boolean allowed(HttpSession session, String resource, String operation)
  {
    KeelRequest keelRequest = new ModelRequestMessage();

    keelRequest.setModel("security.authorization");
    keelRequest.setAttribute("sessionid", session.getId());
    keelRequest.setParameter("component", resource);

    if (operation != null)
    {
      keelRequest.setParameter("operation", operation);
    }

    try
    {
      KeelResponse response = getClient(session).execute(keelRequest);
View Full Code Here

  {
  } // ModelRequestDeserializer

  public static KeelRequest deserialize(Element root)
  {
    KeelRequest req = new ModelRequestMessage();

    req.setModel(root.getAttribute("model"));

    /* Handle the request attributes */
    NamedNodeMap attrs = root.getAttributes();
    Node oneAttrNode = null;

    for (int i = 0; i < attrs.getLength(); i++)
    {
      oneAttrNode = attrs.item(i);
      req.setAttribute(oneAttrNode.getLocalName(), oneAttrNode.getNodeValue());
    }

    NodeList children = root.getChildNodes();
    Node oneChild = null;

    for (int i = 0; i < children.getLength(); i++)
    {
      oneChild = children.item(i);

      if (oneChild != null)
      {
        String name = oneChild.getLocalName();

        if (name == null)
        {
          name = "";
        }

        if (name.equals("parameters"))
        {
          /* Now for each "parameter" sub-node */
          Node oneParamNode = null;
          NodeList parameterNodes = oneChild.getChildNodes();

          for (int j = 0; j < parameterNodes.getLength(); j++)
          {
            oneParamNode = parameterNodes.item(j);

            if (oneParamNode != null)
            {
              String pnodeName = oneParamNode.getLocalName();

              if (pnodeName == null)
              {
                pnodeName = "";
              }

              if (pnodeName.equals("parameter"))
              {
                String paramName = null;
                String paramValue = null;
                NamedNodeMap paramAttrs = oneParamNode.getAttributes();
                Node oneParamAttr = null;

                for (int k = 0; k < paramAttrs.getLength(); k++)
                {
                  oneParamAttr = paramAttrs.item(k);

                  if (oneParamAttr.getLocalName().equals("name"))
                  {
                    paramName = oneParamAttr.getNodeValue();
                  }

                  if (oneParamAttr.getLocalName().equals("value"))
                  {
                    paramValue = oneParamAttr.getNodeValue();
                  }
                }

                req.setParameter(paramName, paramValue);
              }
            }
          } /* if the child is "parameter" */
        } /* for each child of "parameters" */
      } /* if the child is "parameters" */
 
View Full Code Here

    {
      setContext(parseInitParameters(wreq));
      initParamsParsed = true;
    }

    KeelRequest kreq = makeKeelRequest(wreq, defaultModelName);

    KeelResponse kres = super.execute(kreq);

    if (kres == null)
    {
      throw new ClientException("Model response was null");
    }

    String modelName = kreq.getModel();

    kres.setAttribute("model", modelName);

    makeWebappResponse(kreq, kres, wres, wreq, modelName);
View Full Code Here

   * @return The Keel request
   * @throws ClientException
   */
  protected KeelRequest makeKeelRequest(WebappRequest wreq, String defaultModelName) throws ClientException
  {
    KeelRequest kreq = createRequest();

    setRequestParameters(wreq, kreq);
    setRequestModel(wreq, kreq, defaultModelName);
    setRequestAttributes(wreq, kreq);
    setRequestCookies(wreq, kreq);
View Full Code Here

    return oneParamName;
  }

  protected KeelRequest createRequest()
  {
    KeelRequest kreq = new ModelRequestMessage();

    return kreq;
  }
View Full Code Here

TOP

Related Classes of de.iritgo.aktera.model.KeelRequest

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.