Package org.cometd.bayeux.server

Examples of org.cometd.bayeux.server.BayeuxServer$Extension


{
  private static final long serialVersionUID = 7604935279491387654L;

  public void init() throws ServletException
    {
        BayeuxServer bayeux = (BayeuxServer)getServletContext().getAttribute(BayeuxServer.ATTRIBUTE);
        new HelloService(bayeux);
    }
View Full Code Here


    */
  private void init(SessionHandler sessionHandler) {
    this.collabInterfaces = new HashSet<CollabInterface>();

    this.sessionHandler = sessionHandler;
    BayeuxServer server = SessionManager.getInstance().getBayeux();

    String sessionId = sessionHandler.getSessionId();
    this.localSession = server.newLocalSession(sessionId);
    this.localSession.setAttribute("sessionid", sessionId);
    this.localSession.handshake();
    this.serverSession = this.localSession.getServerSession();
    this.setSessionAttribute("sessionid", sessionId);
    this.setSessionAttribute("username", "moderator");
View Full Code Here

    super.init();

    ServletContext servletContext = this.getServletContext();

    // get the bayeux server and register the bayeux ack extension.
    BayeuxServer bayeux = (BayeuxServer) servletContext
        .getAttribute(BayeuxServer.ATTRIBUTE);
    bayeux.addExtension(new AcknowledgedMessagesExtension());

    // parse the coweb configuration file for this application.
    ServletConfig config = this.getServletConfig();
    Map<String, Object> cowebConfig = null;
    try {
      cowebConfig = this.getCowebConfigOptions(config);
    } catch (Exception e1) {
      e1.printStackTrace();
      cowebConfig = new HashMap<String, Object>();
    }
   
    int logLevel = 0;

    if (cowebConfig.get("logLevel") != null) {
      Long level = (Long)cowebConfig.get("logLevel");
      logLevel = level.intValue();
    }
   
    Logger parentLogger = Logger.getLogger("org.coweb");
    parentLogger.setUseParentHandlers(false);
    ConsoleHandler consoleHandler = new ConsoleHandler();
    parentLogger.addHandler(consoleHandler);
   
    switch (logLevel) {
      case 0:
        parentLogger.setLevel(Level.WARNING);
        consoleHandler.setLevel(Level.WARNING);
        break;
      case 1
        parentLogger.setLevel(Level.INFO);
        consoleHandler.setLevel(Level.INFO);
        break;
      case 2
        parentLogger.setLevel(Level.FINE);
        consoleHandler.setLevel(Level.FINE);
        break;
    }
   
    log.info("servlet init");
    log.info("cowebConfig = " + cowebConfig.toString());

    // setup any debug options for capturing incoming and outgoing
    // bayeux traffic.
    String captureIncoming = (String) cowebConfig.get("captureIncoming");
    String captureOutgoing = (String) cowebConfig.get("captureOutgoing");
    if (captureIncoming != null || captureOutgoing != null) {
      try {
        CowebExtension cowebExtension = new CowebExtension(
            captureIncoming, captureOutgoing);
        bayeux.addExtension(cowebExtension);
      } catch (Exception e) {
        log.info(e.getMessage());
      }
    }

    bayeux.setSecurityPolicy(new CowebSecurityPolicy());

    /* Create the SessionManager instance. The SessionManager also listens
         * to all bayeux traffic. */
    this.sessionManager = SessionManager.newInstance(cowebConfig, bayeux);
  }
View Full Code Here

   * @param client The old client.
   */
  protected void sendRosterUnavailable(ServerSession client) {
    log.fine("CollabSessionHandler::sendRosterUnavailable");
    /* create channel */
        BayeuxServer server = this.sessionManager.getBayeux();
        ServerChannel.Initializer initializer =
            new ServerChannel.Initializer() {
      @Override
      public void configureChannel(ConfigurableServerChannel channel) {
        channel.setPersistent(true);
      }
    };

    String rosterUnavailableChannel =
            this.sessionHandler.getRosterUnavailableChannel();
    server.createIfAbsent(rosterUnavailableChannel, initializer);
    ServerChannel channel = server.getChannel(rosterUnavailableChannel);
    if (channel == null) {
      return;
    }

    ServerSession from = this.sessionManager.getServerSession();
View Full Code Here

            if (result == null)
                result = defaultCase(theEObject);
            return result;
        }
        case Bpmn2Package.EXTENSION: {
            Extension extension = (Extension) theEObject;
            T result = caseExtension(extension);
            if (result == null)
                result = defaultCase(theEObject);
            return result;
        }
View Full Code Here

        @Override
        public void endElement(String uri, String localName, String name) {
            // Detect Extension object
            EObject peekObject = objects.peek();
            if (peekObject instanceof Extension) {
                Extension extension = (Extension) peekObject;
                if (extension.isMustUnderstand() && null != extension.getXsdDefinition()) {
                    loadExtensionSchema(extension.getXsdDefinition());
                }
            }
            super.endElement(uri, localName, name);
        }
View Full Code Here

   }

   public static Extension createExtension(Object any)
   {
      ParameterValidation.throwIllegalArgExceptionIfNull(any, "Any");
      Extension extension = new Extension();
      extension.setAny(any);

      return extension;
   }
View Full Code Here

   {
      public Extension apply(V1Extension from)
      {
         if (from != null)
         {
            Extension extension = WSRPTypeFactory.createExtension(from.getAny());
            return extension;
         }
         else
         {
            return null;
View Full Code Here

   }

   public static Extension createExtension(Object any)
   {
      ParameterValidation.throwIllegalArgExceptionIfNull(any, "Any");
      Extension extension = new Extension();
      extension.setAny(any);

      return extension;
   }
View Full Code Here

   }

   public static Extension createExtension(Object any)
   {
      ParameterValidation.throwIllegalArgExceptionIfNull(any, "Any");
      Extension extension = new Extension();
      extension.setAny(any);

      return extension;
   }
View Full Code Here

TOP

Related Classes of org.cometd.bayeux.server.BayeuxServer$Extension

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.