Package ca.simplegames.micro

Examples of ca.simplegames.micro.SiteContext


     */
    public void execute(MicroContext context, Map configuration) throws ControllerException {
        final Logger logger = LoggerFactory.getLogger(controllerName);
        try {
            // pre-load the engine to make sure we were called right
            final SiteContext site = context.getSiteContext();
            if (site != null) {
                BSFEngine bsfEngine = site.getBSFEngine(language, context, configuration, logger);
                // Execute with the proper language, the fileName (for error reporting),
                // the row and column to start at, and finally the contents of the script
                // some examples: http://massapi.com/class/bs/BSFManager.html
                bsfEngine.exec(controllerName, 0, 0, script);

View Full Code Here


        }
    }

    private void executeControllers(MicroContext context) throws ControllerNotFoundException, ControllerException {
        if (!CollectionUtils.isEmpty(controllers)) {
            SiteContext site = context.getSiteContext();
            for (Map<String, Object> controllerMap : controllers) {
                site.getControllerManager().execute((String) controllerMap.get(Globals.NAME),
                        context, (Map) controllerMap.get(Globals.OPTIONS));
                if (context.isHalt()) {
                    break;
                }
            }
View Full Code Here

    private static final String IMAGE_FILE = "image_file";
    private static final String TYPE = "type";

    @SuppressWarnings("unchecked")
    public void execute(MicroContext context, Map configuration) throws ControllerException {
        SiteContext site = context.getSiteContext();
        Map<String, Object> params = (Map<String, Object>) context.get(Globals.PARAMS);
        Repository defaultRepository = site.getRepositoryManager().getDefaultRepository();
        if (configuration != null && configuration.get(Globals.REPOSITORY) != null) {
            defaultRepository = site.getRepositoryManager()
                    .getRepository((String) configuration.get(Globals.REPOSITORY));
        }

        File file = defaultRepository.pathToFile(
                String.format(FILE_FORMAT, params.get(IMAGE_FILE), params.get(TYPE)));
View Full Code Here

    @Override
    public RackResponse call(MicroContext context) throws Exception {
        RackResponse response = null;

        if (context != null) {
            SiteContext site = context.getSiteContext();

            if (!CollectionUtils.isEmpty(getControllers())) {
                for (int i = 0; i < getControllers().size(); i++) {
                    Map<String, Object> controllerMap = getControllers().get(i);
                    site.getControllerManager().execute((String) controllerMap.get(Globals.NAME),
                            context, (Map) controllerMap.get(Globals.OPTIONS));
                    if (context.isHalt()) return context.getRackResponse();
                }
            }

            if (getView() != null && getView().getPath() != null) {
                response = context.getRackResponse();
                RepositoryManager repositoryManager = site.getRepositoryManager();
                String repositoryName = StringUtils.defaultString(getView().getRepositoryName(),
                        repositoryManager.getDefaultRepository().getName());

                String path = getView().getPath();
View Full Code Here

TOP

Related Classes of ca.simplegames.micro.SiteContext

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.