Package org.apache.slide.projector

Examples of org.apache.slide.projector.Context


    private final static String allowedChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
   
    public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
      ApplicationManager.getInstance();
      boolean sessionCreated = request.getSession(false) == null;
      Context context = new HttpContext(request, response);
        logger.log(Level.FINE, "Request uri=" + request.getRequestURI());
        logger.log(Level.FINE, "Context path=" + request.getContextPath());
        logger.log(Level.FINE, "Servlet path=" + request.getServletPath());
        URI uri = new URIValue(request.getRequestURI().substring(request.getContextPath().length()+request.getServletPath().length()+1));
        try {
            Result result;
            Processor processor;
            try {
                logger.log(Level.FINE, "Processing started with URI=" + uri);
                Map requestParameters = request.getParameterMap();
                if ( requestParameters.containsKey(Constants.PROCESS_ID_PARAMETER) ) {
                  context.setProcessId(requestParameters.get(Constants.PROCESS_ID_PARAMETER).toString());
                } else {
                    StringBuffer processIdBuffer = new StringBuffer(Constants.PROCESS_ID_LENGTH);
                  for ( int i = 0; i < Constants.PROCESS_ID_LENGTH; i++) {
                      processIdBuffer.append(allowedChars.charAt(random.nextInt(allowedChars.length())));
                  }
                  context.setProcessId(processIdBuffer.toString());
                }
                processor = ProcessorManager.getInstance().getProcessor(uri);
                Scheduler.getInstance();
                Scheduler.setContext(context);
              if ( sessionCreated ) {
                // new session
                    Scheduler.getInstance().launchSessionJobs(context);
              }
                Scheduler.getInstance().launchRequestJobs(context);
                if ( ProcessorManager.getInstance().getProcessorDescriptor(uri).isBookmark() ) {
                    context.setBookmark(uri);
                }
                ParameterDescriptor[] parameterDescriptors = processor.getParameterDescriptors();
                result = ProcessorManager.process(processor, new HashMap(requestParameters), context);
            } catch ( Exception exception ) {
                logger.log(Level.SEVERE, "Exception while processing processor with URI="+uri+"", exception);
View Full Code Here


        super(parent);
        this.uri = uri;
    }

    public Class findClass(String name) throws ClassNotFoundException {
        Context context = new SystemContext();
        try {
            URI rendererUri = new URIValue(uri.toString() + name.replace('.', '/') + ".class");
            StreamableValue resource = ((StreamableValue)Projector.getRepository().getResource(rendererUri, context.getCredentials()));
            if ( resource == null ) {
              throw new ClassNotFoundException("Class " + name + " at URI '"+rendererUri+"' not found in collection '" + uri + "'!");
            }
            InputStream inputStream = resource.getInputStream();
            ByteArrayOutputStream outputStream = new ByteArrayOutputStream(1024);
View Full Code Here

    }

    public void run() {
        try {
            logger.log(Level.FINE, "Launching scheduled process '"+getProcessorUri()+"'");
            Context context = new SystemContext();
            Scheduler.setContext(context);
            ProcessorManager.getInstance().process(getProcessorUri(), getParameters(), context);
        } catch ( Exception e ) {
            logger.log(Level.SEVERE, "Scheduled process '"+getProcessorUri()+"' failed", e);
        }
View Full Code Here

TOP

Related Classes of org.apache.slide.projector.Context

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.