Example usage for org.springframework.web.context WebApplicationContext ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE

List of usage examples for org.springframework.web.context WebApplicationContext ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE

Introduction

In this page you can find the example usage for org.springframework.web.context WebApplicationContext ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE.

Prototype

String ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE

To view the source code for org.springframework.web.context WebApplicationContext ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE.

Click Source Link

Document

Context attribute to bind root WebApplicationContext to on successful startup.

Usage

From source file:org.red5.server.war.MainServlet.java

/**
 * Main entry point for the Red5 Server as a war
 *///from   w  w w  . j ava2  s .c o m
// Notification that the web application is ready to process requests
public void contextInitialized(ServletContextEvent sce) {
    System.setProperty("red5.deployment.type", "war");

    if (null != servletContext) {
        return;
    }
    servletContext = sce.getServletContext();
    String prefix = servletContext.getRealPath("/");

    long time = System.currentTimeMillis();

    logger.info("RED5 Server (http://www.osflash.org/red5)");
    logger.info("Loading red5 global context from: " + red5Config);
    logger.info("Path: " + prefix);

    try {
        // Detect root of Red5 configuration and set as system property
        String root;
        String classpath = System.getProperty("java.class.path");
        File fp = new File(prefix + red5Config);
        fp = fp.getCanonicalFile();
        if (!fp.isFile()) {
            // Given file does not exist, search it on the classpath
            String[] paths = classpath.split(System.getProperty("path.separator"));
            for (String element : paths) {
                fp = new File(element + "/" + red5Config);
                fp = fp.getCanonicalFile();
                if (fp.isFile()) {
                    break;
                }
            }
        }
        if (!fp.isFile()) {
            throw new Exception(
                    "could not find configuration file " + red5Config + " on your classpath " + classpath);
        }

        root = fp.getAbsolutePath();
        root = root.replace('\\', '/');
        int idx = root.lastIndexOf('/');
        root = root.substring(0, idx);
        // update classpath
        System.setProperty("java.class.path",
                classpath + File.pathSeparatorChar + root + File.pathSeparatorChar + root + "/classes");
        logger.debug("New classpath: " + System.getProperty("java.class.path"));
        // set configuration root
        System.setProperty("red5.config_root", root);
        logger.info("Setting configuation root to " + root);

        // Setup system properties so they can be evaluated
        Properties props = new Properties();
        props.load(new FileInputStream(root + "/red5.properties"));
        for (Object o : props.keySet()) {
            String key = (String) o;
            if (StringUtils.isNotBlank(key)) {
                System.setProperty(key, props.getProperty(key));
            }
        }

        // Store root directory of Red5
        idx = root.lastIndexOf('/');
        root = root.substring(0, idx);
        if (System.getProperty("file.separator").equals("/")) {
            // Workaround for linux systems
            root = "/" + root;
        }
        System.setProperty("red5.root", root);
        logger.info("Setting Red5 root to " + root);

        Class contextClass = org.springframework.web.context.support.XmlWebApplicationContext.class;
        ConfigurableWebApplicationContext applicationContext = (ConfigurableWebApplicationContext) BeanUtils
                .instantiateClass(contextClass);

        String[] strArray = servletContext.getInitParameter(ContextLoader.CONFIG_LOCATION_PARAM)
                .split("[,\\s]");
        logger.info("Config location files: " + strArray.length);
        applicationContext.setConfigLocations(strArray);
        applicationContext.setServletContext(servletContext);
        applicationContext.refresh();

        // set web application context as an attribute of the servlet
        // context so that it may be located via Springs
        // WebApplicationContextUtils
        servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE,
                applicationContext);

        ConfigurableBeanFactory factory = applicationContext.getBeanFactory();
        // register default
        // add the context to the parent
        factory.registerSingleton("default.context", applicationContext);

    } catch (Throwable e) {
        logger.error("", e);
    }

    long startupIn = System.currentTimeMillis() - time;
    logger.info("Startup done in: " + startupIn + " ms");

}

From source file:org.red5.server.war.MainServlet.java

/**
 * Clearing the in-memory configuration parameters, we will receive
 * notification that the servlet context is about to be shut down
 *//*from  w ww.ja  v a2s  . c o m*/
public void contextDestroyed(ServletContextEvent sce) {
    logger.info("Webapp shutdown");
    // XXX Paul: grabbed this from
    // http://opensource.atlassian.com/confluence/spring/display/DISC/Memory+leak+-+classloader+won%27t+let+go
    // in hopes that we can clear all the issues with J2EE containers during
    // shutdown
    try {
        // prepare spring for shutdown
        Introspector.flushCaches();
        // dereg any drivers
        for (Enumeration e = DriverManager.getDrivers(); e.hasMoreElements();) {
            Driver driver = (Driver) e.nextElement();
            if (driver.getClass().getClassLoader() == getClass().getClassLoader()) {
                DriverManager.deregisterDriver(driver);
            }
        }
        // shutdown jmx
        JMXAgent.shutdown();
        // shutdown spring
        // get web application context from the servlet context
        ConfigurableWebApplicationContext applicationContext = (ConfigurableWebApplicationContext) servletContext
                .getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
        ConfigurableBeanFactory factory = applicationContext.getBeanFactory();
        if (factory.containsSingleton("default.context")) {
            for (String scope : factory.getRegisteredScopeNames()) {
                logger.debug("Registered scope: " + scope);
            }
            for (String singleton : factory.getSingletonNames()) {
                logger.debug("Registered singleton: " + singleton);
                // factory.destroyScopedBean(singleton);
            }
            factory.destroySingletons();
        }
        servletContext.removeAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
        applicationContext.close();
        // http://jakarta.apache.org/commons/logging/guide.html#Classloader_and_Memory_Management
        // http://wiki.apache.org/jakarta-commons/Logging/UndeployMemoryLeak?action=print
        // LogFactory.release(Thread.currentThread().getContextClassLoader());
    } catch (Throwable e) {
        // may get a java.lang.StackOverflowError when shutting appcontext
        // down in jboss
        e.printStackTrace();
    }
}

From source file:org.red5.server.war.WarLoaderServlet.java

public void registerSubContext(String webAppKey) {
    // get the sub contexts - servlet context
    ServletContext ctx = servletContext.getContext(webAppKey);
    if (ctx == null) {
        ctx = servletContext;// w  ww. jav a 2 s .  c  o  m
    }
    ContextLoader loader = new ContextLoader();
    ConfigurableWebApplicationContext appCtx = (ConfigurableWebApplicationContext) loader
            .initWebApplicationContext(ctx);
    appCtx.setParent(applicationContext);
    appCtx.refresh();

    ctx.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, appCtx);

    ConfigurableBeanFactory appFactory = appCtx.getBeanFactory();

    logger.debug("About to grab Webcontext bean for " + webAppKey);
    Context webContext = (Context) appCtx.getBean("web.context");
    webContext.setCoreBeanFactory(parentFactory);
    webContext.setClientRegistry(clientRegistry);
    webContext.setServiceInvoker(globalInvoker);
    webContext.setScopeResolver(globalResolver);
    webContext.setMappingStrategy(globalStrategy);

    WebScope scope = (WebScope) appFactory.getBean("web.scope");
    scope.setServer(server);
    scope.setParent(global);
    scope.register();
    scope.start();

    // register the context so we dont try to reinitialize it
    registeredContexts.add(ctx);

}

From source file:org.red5.server.war.WarLoaderServlet.java

/**
 * Clearing the in-memory configuration parameters, we will receive
 * notification that the servlet context is about to be shut down
 *//*from www .  j a  v a 2s .c  o  m*/
@Override
public void contextDestroyed(ServletContextEvent sce) {
    synchronized (servletContext) {
        logger.info("Webapp shutdown");
        // XXX Paul: grabbed this from
        // http://opensource.atlassian.com/confluence/spring/display/DISC/Memory+leak+-+classloader+won%27t+let+go
        // in hopes that we can clear all the issues with J2EE containers
        // during shutdown
        try {
            ServletContext ctx = sce.getServletContext();
            // prepare spring for shutdown
            Introspector.flushCaches();
            // dereg any drivers
            for (Enumeration e = DriverManager.getDrivers(); e.hasMoreElements();) {
                Driver driver = (Driver) e.nextElement();
                if (driver.getClass().getClassLoader() == getClass().getClassLoader()) {
                    DriverManager.deregisterDriver(driver);
                }
            }
            // shutdown jmx
            JMXAgent.shutdown();
            // shutdown the persistence thread
            FilePersistenceThread persistenceThread = FilePersistenceThread.getInstance();
            if (persistenceThread != null) {
                persistenceThread.shutdown();
            }
            // shutdown spring
            Object attr = ctx.getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
            if (attr != null) {
                // get web application context from the servlet context
                ConfigurableWebApplicationContext applicationContext = (ConfigurableWebApplicationContext) attr;
                ConfigurableBeanFactory factory = applicationContext.getBeanFactory();
                // for (String scope : factory.getRegisteredScopeNames()) {
                // logger.debug("Registered scope: " + scope);
                // }
                try {
                    for (String singleton : factory.getSingletonNames()) {
                        logger.debug("Registered singleton: " + singleton);
                        factory.destroyScopedBean(singleton);
                    }
                } catch (RuntimeException e) {
                }
                factory.destroySingletons();
                ctx.removeAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
                applicationContext.close();
            }
            getContextLoader().closeWebApplicationContext(ctx);
            //            org.apache.commons.logging.LogFactory.releaseAll();
            //            org.apache.log4j.LogManager.getLoggerRepository().shutdown();
            //            org.apache.log4j.LogManager.shutdown();
        } catch (Throwable e) {
            e.printStackTrace();
        }
    }
}

From source file:org.red5.stream.http.servlet.PlayList.java

/**
 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
 *///from   w  w  w. j a  va  2s . c  o  m
protected void doPost(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    log.debug("Playlist requested");
    /*
     * EXT-X-MEDIA-SEQUENCE
     * Each media file URI in a Playlist has a unique sequence number.  The sequence number 
     * of a URI is equal to the sequence number of the URI that preceded it plus one. The 
     * EXT-X-MEDIA-SEQUENCE tag indicates the sequence number of the first URI that appears
     * in a Playlist file.
     * 
        #EXTM3U
        #EXT-X-ALLOW-CACHE:NO
       #EXT-X-MEDIA-SEQUENCE:0
       #EXT-X-TARGETDURATION:10
       #EXTINF:10,
       http://media.example.com/segment1.ts
       #EXTINF:10,
       http://media.example.com/segment2.ts
       #EXTINF:10,
       http://media.example.com/segment3.ts
       #EXT-X-ENDLIST
               
       Using one large file, testing with ipod touch, this worked (149 == 2:29)
       #EXTM3U
       #EXT-X-TARGETDURATION:149
       #EXT-X-MEDIA-SEQUENCE:0
       #EXTINF:149, no desc
       out0.ts
       #EXT-X-ENDLIST
               
       Using these encoding parameters:
       ffmpeg -i test.mp4 -re -an -vcodec libx264 -b 96k -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 
       -subq 5 -trellis 1 -refs 1 -coder 0 -me_range 16 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -bt 200k -maxrate 96k 
       -bufsize 96k -rc_eq 'blurCplx^(1-qComp)' -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -level 30 -aspect 320:240 -g 30 -async 2 
       -s 320x240 -f mpegts out.ts
            
     */

    //get the requested stream

    ApplicationContext appCtx = (ApplicationContext) getServletContext()
            .getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
    SegmenterService service = (SegmenterService) appCtx.getBean("segmenter.service");

    String servletPath = request.getServletPath();

    if (log.isTraceEnabled()) {
        String serverName = request.getServerName();
        int portNumber = request.getServerPort();
        String contextPath = request.getContextPath();
        log.trace("Request - serverName: {} port: {} contextPath: {} servletPath: {}",
                new Object[] { serverName, portNumber, contextPath, servletPath });
    }

    //for debugging
    //String url = String.format("%s:%s%s", serverName, portNumber, contextPath);;
    final String streamName = servletPath.substring(1, servletPath.indexOf(".m3u8"));
    log.debug("Request for stream: {} playlist", streamName);

    //write the playlist
    PrintWriter writer = response.getWriter();

    response.setContentType("application/x-mpegURL");

    writer.println("#EXTM3U\n#EXT-X-ALLOW-CACHE:NO\n");

    //check for the stream
    if (service.isAvailable(streamName)) {
        log.debug("Stream: {} is available", streamName);
        // remove it from requested list if its there
        if (requestedStreams.contains(streamName)) {
            requestedStreams.remove(requestedStreams.indexOf(streamName));
        }
        // get the segment count
        int count = service.getSegmentCount(streamName);
        log.debug("Segment count: {}", count);
        // check for minimum segment count and if we dont match or exceed
        // wait for (minimum segment count * segment duration) before returning
        if (count < minimumSegmentCount) {
            log.debug("Starting wait loop for segment availability");
            long maxWaitTime = minimumSegmentCount * service.getSegmentTimeLimit();
            long start = System.currentTimeMillis();
            do {
                try {
                    Thread.sleep(500);
                } catch (InterruptedException e) {
                }
                if ((System.currentTimeMillis() - start) >= maxWaitTime) {
                    log.info("Maximum segment wait time exceeded for {}", streamName);
                    break;
                }
            } while ((count = service.getSegmentCount(streamName)) < minimumSegmentCount);
        }
        // get the count one last time
        count = service.getSegmentCount(streamName);
        log.debug("Segment count: {}", count);
        if (count >= minimumSegmentCount) {
            //get segment duration in seconds
            long segmentDuration = service.getSegmentTimeLimit() / 1000;
            //get the current segment
            Segment segment = service.getSegment(streamName);
            //get current sequence number
            int sequenceNumber = segment.getIndex();
            log.trace("Current sequence number: {}", sequenceNumber);
            /*
            HTTP streaming spec section 3.2.2
            Each media file URI in a Playlist has a unique sequence number.  The sequence number of a URI is equal to the sequence number
            of the URI that preceded it plus one. The EXT-X-MEDIA-SEQUENCE tag indicates the sequence number of the first URI that appears 
            in a Playlist file.
            */
            // determine the lowest sequence number
            int lowestSequenceNumber = Math.max(-1, sequenceNumber - service.getMaxSegmentsPerFacade()) + 1;
            log.trace("Lowest sequence number: {}", lowestSequenceNumber);
            // for logging
            StringBuilder sb = new StringBuilder();
            // create the heading
            String playListHeading = String.format("#EXT-X-TARGETDURATION:%s\n#EXT-X-MEDIA-SEQUENCE:%s\n",
                    segmentDuration, lowestSequenceNumber);
            writer.println(playListHeading);
            sb.append(playListHeading);
            //loop through the x closest segments
            for (int s = lowestSequenceNumber; s <= sequenceNumber; s++) {
                String playListEntry = String.format("#EXTINF:%s, no desc\n%s%s.ts\n", segmentDuration,
                        streamName, s);
                writer.println(playListEntry);
                sb.append(playListEntry);
            }
            // are we on the last segment?
            if (segment.isLast()) {
                log.debug("Last segment");
                writer.println("#EXT-X-ENDLIST\n");
                sb.append("#EXT-X-ENDLIST\n");
            }
            log.debug(sb.toString());
        } else {
            log.trace("Minimum segment count not yet reached, currently at: {}", count);
        }
    } else {
        log.debug("Stream: {} is not available", streamName);
        // look for flag to indicate that we should spawn the requested stream
        if (startStreamOnRequest) {
            if (requestedStreams.contains(streamName)) {
                log.debug("Stream has already been requested and is not yet available: {}", streamName);
            } else {
                // add to the requested list
                requestedStreams.add(streamName);
                // perform the actions required for starting up a stream
                log.debug("A stream that is not yet available will be spawned");
                // TODO create a SimpleMediaFile that represents our stream               
                SimpleMediaFile smf = new SimpleMediaFile();
                smf.setHasAudio(false);
                smf.setHasVideo(true);
                smf.setVideoCodec(ICodec.ID.CODEC_ID_H264);
                // TODO if on-demand creation is wanted in your application, the Observed class
                // must be instanced here and the SegmenterService must be added as an Observer of the class

                // TODO create a thread to clean up if the stream is not created within x time
                /*
                // start a thread to remove the requested stream name from the list after 2 minutes               
                Application.executorService.execute(new Runnable() {
                   public void run() {
                      try {
                Thread.sleep(120000);
                     } catch (InterruptedException e) {
                     }
                      if (requestedStreams.contains(streamName)) {
                 requestedStreams.remove(requestedStreams.indexOf(streamName));
                      }   
                   }
                });
                */
            }
        } else {
            writer.println("#EXT-X-ENDLIST\n");
        }
    }

    writer.flush();

}

From source file:org.sakaiproject.tool.gradebook.ui.RoleFilter.java

public void init(FilterConfig filterConfig) throws ServletException {
    if (logger.isInfoEnabled())
        logger.info("Initializing gradebook role filter");

    ac = (ApplicationContext) filterConfig.getServletContext()
            .getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);

    authnServiceBeanName = filterConfig.getInitParameter("authnServiceBean");
    authzServiceBeanName = filterConfig.getInitParameter("authzServiceBean");
    contextManagementServiceBeanName = filterConfig.getInitParameter("contextManagementServiceBean");
    authorizationFilterConfigurationBeanName = filterConfig
            .getInitParameter("authorizationFilterConfigurationBean");
    selectGradebookRedirect = filterConfig.getInitParameter("selectGradebookRedirect");
}

From source file:org.springbyexample.web.service.EmbeddedJetty.java

@PostConstruct
public void init() throws Exception {
    ctx = new ClassPathXmlApplicationContext();
    ((AbstractApplicationContext) ctx).getEnvironment().setActiveProfiles(activeProfiles);
    ((AbstractXmlApplicationContext) ctx).setConfigLocations(configLocations);

    if (logger.isInfoEnabled()) {
        logger.info("Creating embedded jetty context.  activeProfiles='{}'  configLocations='{}'",
                new Object[] { ArrayUtils.toString(activeProfiles), ArrayUtils.toString(configLocations) });
    }/*from w w w.  ja  v a 2  s  .c  o  m*/

    ((AbstractXmlApplicationContext) ctx).refresh();

    ((AbstractApplicationContext) ctx).registerShutdownHook();

    Server server = (Server) ctx.getBean("jettyServer");

    if (port > 0) {
        Connector connector = server.getConnectors()[0];
        connector.setPort(port);
    }

    ServletContext servletContext = null;

    for (Handler handler : server.getHandlers()) {
        if (handler instanceof Context) {
            Context context = (Context) handler;

            if (StringUtils.hasText(contextPath)) {
                context.setContextPath("/" + contextPath);
            }

            servletContext = context.getServletContext();

            // setup Spring Security Filter
            FilterHolder filterHolder = new FilterHolder();
            filterHolder.setName(SECURITY_FILTER_NAME);
            filterHolder.setClassName(DelegatingFilterProxy.class.getName());

            context.getServletHandler().addFilterWithMapping(filterHolder, "/*", 0);

            break;
        }
    }

    XmlWebApplicationContext wctx = new XmlWebApplicationContext();
    wctx.setParent(ctx);
    wctx.setConfigLocation("");
    wctx.setServletContext(servletContext);
    wctx.refresh();

    servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, wctx);

    server.start();

    logger.info("Server started.");
}

From source file:org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.java

/**
 * Prepare the {@link WebApplicationContext} with the given fully loaded
 * {@link ServletContext}. This method is usually called from
 * {@link ServletContextInitializer#onStartup(ServletContext)} and is similar to the
 * functionality usually provided by a {@link ContextLoaderListener}.
 * @param servletContext the operational servlet context
 *//*from w ww .j  av a 2 s .  c  om*/
protected void prepareEmbeddedWebApplicationContext(ServletContext servletContext) {
    Object rootContext = servletContext
            .getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
    if (rootContext != null) {
        if (rootContext == this) {
            throw new IllegalStateException(
                    "Cannot initialize context because there is already a root application context present - "
                            + "check whether you have multiple ServletContextInitializers!");
        }
        return;
    }
    Log logger = LogFactory.getLog(ContextLoader.class);
    servletContext.log("Initializing Spring embedded WebApplicationContext");
    try {
        servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, this);
        if (logger.isDebugEnabled()) {
            logger.debug("Published root WebApplicationContext as ServletContext attribute with name ["
                    + WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE + "]");
        }
        setServletContext(servletContext);
        if (logger.isInfoEnabled()) {
            long elapsedTime = System.currentTimeMillis() - getStartupDate();
            logger.info("Root WebApplicationContext: initialization completed in " + elapsedTime + " ms");
        }
    } catch (RuntimeException ex) {
        logger.error("Context initialization failed", ex);
        servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, ex);
        throw ex;
    } catch (Error ex) {
        logger.error("Context initialization failed", ex);
        servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, ex);
        throw ex;
    }
}

From source file:org.springframework.boot.context.web.SpringBootServletInitializer.java

protected WebApplicationContext createRootApplicationContext(ServletContext servletContext) {
    SpringApplicationBuilder builder = createSpringApplicationBuilder();
    builder.main(getClass());/*from   w w  w  . jav a  2  s.c o m*/
    ApplicationContext parent = getExistingRootWebApplicationContext(servletContext);
    if (parent != null) {
        this.logger.info("Root context already created (using as parent).");
        servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, null);
        builder.initializers(new ParentContextApplicationContextInitializer(parent));
    }
    builder.initializers(new ServletContextApplicationContextInitializer(servletContext));
    builder.contextClass(AnnotationConfigEmbeddedWebApplicationContext.class);
    builder = configure(builder);
    SpringApplication application = builder.build();
    if (application.getSources().isEmpty()
            && AnnotationUtils.findAnnotation(getClass(), Configuration.class) != null) {
        application.getSources().add(getClass());
    }
    Assert.state(application.getSources().size() > 0,
            "No SpringApplication sources have been defined. Either override the "
                    + "configure method or add an @Configuration annotation");
    // Ensure error pages are registered
    if (this.registerErrorPageFilter) {
        application.getSources().add(ErrorPageFilter.class);
    }
    return run(application);
}

From source file:org.springframework.boot.context.web.SpringBootServletInitializer.java

private ApplicationContext getExistingRootWebApplicationContext(ServletContext servletContext) {
    Object context = servletContext.getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
    if (context instanceof ApplicationContext) {
        return (ApplicationContext) context;
    }/*ww w  .j av  a 2  s.com*/
    return null;
}