Package org.cipango.sipapp

Examples of org.cipango.sipapp.SipAppContext$CLFireEvent


                  {
                      ContextHandler c=(ContextHandler)installed[i];
                     
                      if (c instanceof SipAppContext)
                      {
                        SipAppContext sipAppContext = (SipAppContext) c;
                        if (context.equals(sipAppContext.getContextPath()))
                           continue files;
                      }
                     
                      if (context.equals(c.getContextPath()))
                          continue files;
                     
                      if (c.getBaseResource()!=null && c.getBaseResource().getFile().getAbsolutePath().equals(app.getFile().getAbsolutePath()))
                          continue files;         
                  }
              }
 
              // create a sipapp
              SipAppContext sac = null;
              if (getContexts() instanceof ContextHandlerCollection &&
                  SipAppContext.class.isAssignableFrom(((ContextHandlerCollection) getContexts()).getContextClass()))
              {
                  try
                  {
                      sac =(SipAppContext)((ContextHandlerCollection) getContexts()).getContextClass().newInstance();
                  }
                  catch (Exception e)
                  {
                      throw new Error(e);
                  }
              } else
              {
                  sac = new SipAppContext();
              }
             
              // configure it
              sac.setContextPath(context);
              if (getConfigurationClasses() != null)
                  sac.setConfigurationClasses(getConfigurationClasses());
             
              if (getDefaultsDescriptor() != null)
                  sac.setDefaultsDescriptor(getDefaultsDescriptor());
             
              if (getDefaultsSipDescriptor() != null)
                sac.setDefaultsSipDescriptor(getDefaultsSipDescriptor());
             
              sac.setExtractWAR(isExtract());
              sac.setWar(app.toString());
              sac.setParentLoaderPriority(isParentLoaderPriority());
             
              // add it
              getContexts().addHandler(sac);
              _deployed.add(sac);
             
              if (getContexts().isStarted())
                  sac.start();
          }
          catch (Throwable e)
          {
            mex.add(e);
      }
View Full Code Here


        if (context.endsWith("/") && context.length() > 0)
        {
            context = context.substring(0,context.length() - 1);
        }

        SipAppContext sac = new SipAppContext();
        sac.setContextPath(context);
        sac.setWar(file.getAbsolutePath());
        if (getDefaultsDescriptor() != null)
            sac.setDefaultsDescriptor(getDefaultsDescriptor());
        if (getDefaultsSipDescriptor() != null)
            sac.setDefaultsSipDescriptor(getDefaultsSipDescriptor());
        sac.setExtractWAR(isExtractWars());
        sac.setParentLoaderPriority(isParentLoaderPriority());
        if (getConfigurationClasses() != null)
        {
            sac.setConfigurationClasses(getConfigurationClasses());
        }

        if (getTempDir() != null)
        {
            /* Since the Temp Dir is really a context base temp directory,
             * Lets set the Temp Directory in a way similar to how WebInfConfiguration does it,
             * instead of setting the
             * WebAppContext.setTempDirectory(File). 
             * If we used .setTempDirectory(File) all webapps will wind up in the
             * same temp / work directory, overwriting each others work.
             */
            sac.setAttribute(WebAppContext.BASETEMPDIR, getTempDir());
        }
        return sac;
    }
View Full Code Here

    System.setProperty("org.eclipse.jetty.xml.XmlParser.Validating", "false");
   
    SipDescriptor descriptor = new SipDescriptor(getResource("/org/cipango/xml/sip-xsd.xml"));
    descriptor.parse();
    StandardDescriptorProcessor processor = new StandardDescriptorProcessor();
    processor.process(new SipAppContext(), descriptor);
  }
View Full Code Here

  @Test
  public void testSipXml10() throws Exception
  {
    //System.setProperty("org.eclipse.jetty.xml.XmlParser.Validating", "false");
   
    SipAppContext context = new SipAppContext();
    SipMetaData metaData = context.getSipMetaData();
    metaData.setSipXml(getResource("/org/cipango/xml/sip-sample-1.0.xml"));
    metaData.addDescriptorProcessor(new StandardDescriptorProcessor());
    metaData.resolve(context);

    SipServletHandler servletHandler = (SipServletHandler) context.getServletHandler();
   
    assertEquals(SipAppContext.VERSION_10, context.getSpecVersion());
    assertEquals("SIP Servlet based Registrar", context.getDisplayName());
   
    Enumeration<String> e = context.getInitParameterNames();
    String name = (String) e.nextElement();
    assertEquals("contextConfigLocation", name);
    assertEquals("/WEB-INF/kaleo.xml", context.getInitParameter(name));
    assertFalse(e.hasMoreElements())
   
    assertEquals(TestListener.class, context.getTimerListeners()[0].getClass());
 
    // servlets
    SipServletHolder[] holders = servletHandler.getSipServlets();
    assertEquals(2, holders.length);
   
    assertEquals("main", holders[0].getName());
    // TODO assertEquals("PBX Servlet", holders[0].getDisplayName());
    assertEquals("org.cipango.kaleo.PbxServlet", holders[0].getClassName());
    e = holders[0].getInitParameterNames();
    name = (String) e.nextElement();
    assertEquals("value", holders[0].getInitParameter(name));
    assertFalse(e.hasMoreElements())
    assertEquals(10, holders[0].getInitOrder());
   
    assertEquals("presence", holders[1].getName());
    assertEquals("org.cipango.kaleo.presence.PresenceServlet", holders[1].getClassName());
    assertFalse(holders[1].getInitParameterNames().hasMoreElements())
    assertEquals(0, holders[1].getInitOrder());
   
    // servlet-mapping
    SipServletMapping[] mappings = servletHandler.getSipServletMappings();
    assertEquals(1, mappings.length);
    assertEquals("main", mappings[0].getServletName());
    assertEquals("((request.method == REGISTER) or (request.method == PUBLISH) or (request.method == SUBSCRIBE) or (request.method == INVITE))",
        mappings[0].getMatchingRuleExpression());
    assertEquals(60, context.getSessionTimeout());
   
    assertNull(servletHandler.getMainServlet());
  }
View Full Code Here

 
  @SuppressWarnings("unchecked")
  @Test
  public void testSipXml11() throws Exception
  {
    SipAppContext context = new SipAppContext();
    SipMetaData metaData = context.getSipMetaData();
    metaData.setSipXml(getResource("/org/cipango/xml/sip-sample-1.1.xml"));
    metaData.addDescriptorProcessor(new StandardDescriptorProcessor());
    metaData.resolve(context);
   
    assertEquals(SipAppContext.VERSION_11, context.getSpecVersion());
    assertEquals("SIP Servlet based Registrar", context.getDisplayName());
   
    Enumeration<String> e = context.getInitParameterNames();
    String name = (String) e.nextElement();
    assertEquals("contextConfigLocation", name);
    assertEquals("/WEB-INF/kaleo.xml", context.getInitParameter(name));
    assertFalse(e.hasMoreElements())
   
    assertEquals(TestListener.class, context.getTimerListeners()[0].getClass());
 
    // servlets
    SipServletHandler servletHandler = (SipServletHandler) context.getServletHandler();
    SipServletHolder[] holders = servletHandler.getSipServlets();
    assertEquals(2, holders.length);
   
    assertEquals("main", holders[0].getName());
    // TODO assertEquals("PBX Servlet", holders[0].getDisplayName());
    assertEquals("org.cipango.kaleo.PbxServlet", holders[0].getClassName());
    e = holders[0].getInitParameterNames();
    name = (String) e.nextElement();
    assertEquals("value", holders[0].getInitParameter(name));
    assertFalse(e.hasMoreElements())
    assertEquals(10, holders[0].getInitOrder());
   
    assertEquals("presence", holders[1].getName());
    assertEquals("org.cipango.kaleo.presence.PresenceServlet", holders[1].getClassName());
    assertFalse(holders[1].getInitParameterNames().hasMoreElements())
    assertEquals(0, holders[1].getInitOrder());
   
    // servlet-mapping
    SipServletMapping[] mappings = servletHandler.getSipServletMappings();
    assertNull(mappings);
    assertEquals(60, context.getSessionTimeout());
   
    assertNotNull(servletHandler.getMainServlet());
    assertEquals("main", servletHandler.getMainServlet().getName());
    assertEquals("org.cipango.kaleo", context.getName());
  }
View Full Code Here

  }

  @Test
  public void testMappings11() throws Exception
  {
    SipAppContext context = new SipAppContext();
    SipMetaData metaData = context.getSipMetaData();
    metaData.setSipXml(getResource("/org/cipango/xml/sip-mappings-1.1.xml"));
    metaData.addDescriptorProcessor(new StandardDescriptorProcessor());
    metaData.resolve(context);
       
    assertEquals(SipAppContext.VERSION_11, context.getSpecVersion());
   
    SipServletHandler servletHandler = (SipServletHandler) context.getServletHandler();
    SipServletMapping[] mappings = servletHandler.getSipServletMappings();
    assertEquals(2, mappings.length);
  }
View Full Code Here

  @SuppressWarnings("unchecked")
  @Test
  public void testNamespace() throws Exception
  {
    SipAppContext context = new SipAppContext();
    SipMetaData metaData = context.getSipMetaData();
    metaData.setSipXml(getResource("/org/cipango/xml/sip-namespace.xml"));
    metaData.addDescriptorProcessor(new StandardDescriptorProcessor());
    metaData.resolve(context);
   
    assertEquals(SipAppContext.VERSION_11, context.getSpecVersion());
   
    Enumeration<String> e = context.getInitParameterNames();
    String name = (String) e.nextElement();
    assertNotNull(name);
    assertEquals("contextConfigLocation", name);
    assertEquals("/WEB-INF/kaleo.xml", context.getInitParameter(name));
    assertFalse(e.hasMoreElements())
   
    // servlets
    SipServletHandler servletHandler = (SipServletHandler) context.getServletHandler();
    SipServletHolder[] holders = servletHandler.getSipServlets();
    assertEquals(1, holders.length);
   
    assertEquals("main", holders[0].getName());
    // TODO assertEquals("PBX Servlet", holders[0].getDisplayName());
    assertEquals("org.cipango.kaleo.PbxServlet", holders[0].getClassName());
    e = holders[0].getInitParameterNames();
    name = (String) e.nextElement();
    assertEquals("value", holders[0].getInitParameter(name));
    assertFalse(e.hasMoreElements());     
   
    // servlet-mapping
    SipServletMapping[] mappings = servletHandler.getSipServletMappings();
    assertNull(mappings);
   
    assertEquals("main", servletHandler.getMainServlet().getName());
   
    assertEquals("org.cipango.kaleo", context.getName())
  }
View Full Code Here

   
    SipDescriptor descriptor = new SipDescriptor(getResource("/org/cipango/xml/sip-validated-1.1.xml"));
    descriptor.setValidating(true);
    descriptor.parse();
     
    processor.process(new SipAppContext(), descriptor);
  }
View Full Code Here

  private SipAppContext _context;
 
  @Before
  public void setUp() throws Exception
  {
    _context = new SipAppContext();
    _context.setSecurityHandler(new ConstraintSecurityHandler());
  }
View Full Code Here

    udp.setPort(port);
    tcp.setPort(port);
   
    server.getConnectorManager().setConnectors(new SipConnector[] { udp, tcp });
   
    SipAppContext sipapp = new SipAppContext();
    sipapp.setContextPath("/");
    sipapp.setWar(args[0]);
   
    SipContextHandlerCollection handler = new SipContextHandlerCollection();
    handler.addHandler(sipapp);
   
    server.setApplicationRouter(new DefaultApplicationRouter());
View Full Code Here

TOP

Related Classes of org.cipango.sipapp.SipAppContext$CLFireEvent

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.