Package org.wso2.carbon.ui.deployment.beans

Examples of org.wso2.carbon.ui.deployment.beans.CarbonUIDefinitions


   
    protected static SVGImpl generateSVGImpl(java.io.InputStream is) throws java.io.IOException {
      byte[] b=new byte[is.available()];
      is.read(b);
   
      BPELInterface bpel = new BPELImpl();
        OMElement bpelStr = bpel.load(new String(b));
       
        bpel.processBpelString(bpelStr);

        LayoutManager layoutManager = BPEL2SVGFactory.getInstance().getLayoutManager();
        layoutManager.setVerticalLayout(true);
        layoutManager.setYSpacing(20);
        layoutManager.setYSpacing(50);
        layoutManager.layoutSVG(bpel.getRootActivity());

        SVGImpl svg = new SVGImpl();
        svg.setRootActivity(bpel.getRootActivity());
       
        return(svg);
    }
View Full Code Here


   * @param transformer The optional image transformer
   * @throws java.io.IOException Failed to generate the representation
   */
    public static void generate(java.io.InputStream is, java.io.OutputStream os,
                SVGImageTransformer transformer) throws java.io.IOException {
        SVGImpl svg = generateSVGImpl(is);
       
        if (transformer == null) {
          String str=svg.getHeaders()+svg.generateSVGString();
          os.write(str.getBytes());
        } else {
          transformer.transform(svg, os);
        }
    }
View Full Code Here

        layoutManager.setVerticalLayout(true);
        layoutManager.setYSpacing(20);
        layoutManager.setYSpacing(50);
        layoutManager.layoutSVG(bpel.getRootActivity());

        SVGImpl svg = new SVGImpl();
        svg.setRootActivity(bpel.getRootActivity());
       
        return(svg);
    }
View Full Code Here

        HashMap<String, String> httpUrlsToBeByPassed = new HashMap<String, String>();
        Context defaultContext = null;
        if (bundle != null) {
            ServiceReference reference = bundle.getBundleContext().getServiceReference(
                    CarbonUIDefinitions.class.getName());
            CarbonUIDefinitions carbonUIDefinitions;
            if (reference != null) {
                carbonUIDefinitions = (CarbonUIDefinitions) bundle.getBundleContext().getService(
                        reference);
                if (carbonUIDefinitions != null) {
                    httpUrlsToBeByPassed = carbonUIDefinitions.getHttpUrls();
                    if (carbonUIDefinitions.getContexts().containsKey("default-context")) {
                        defaultContext = carbonUIDefinitions.getContexts().get("default-context");
                    }

                }
            }
        }

        if (requestedURI.equals(context) || requestedURI.equals(context + "/")) {
            if (defaultContext != null && !"".equals(defaultContext.getContextName())
                    && !"null".equals(defaultContext.getContextName())) {
                String adminConsoleURL = CarbonUIUtil.getAdminConsoleURL(request);
                int index = adminConsoleURL.lastIndexOf("carbon");
                String defaultContextUrl = adminConsoleURL.substring(0, index)
                        + defaultContext.getContextName() + "/";
                response.sendRedirect(defaultContextUrl);
            } else {
                response.sendRedirect("carbon");
            }
            return false;
        }
        // when war is deployed on top of an existing app server we cannot use
        // root context
        // for deployment. Hence a new context is added.
        // Now url changes from eg: carbon/admin/index.jsp to
        // wso2/carbon/admin/index.jsp
        // In this case before doing anything, we need to remove web app context
        // (eg: wso2) .
        String tmp = requestedURI;
        String customWarContext = "";
        if (requestedURI.startsWith("/carbon") && !(requestedURI.startsWith("/carbon/carbon/"))) {
            // one can name the folder as 'carbon'
            requestedURI = tmp;
        } else if (requestedURI.indexOf("filedownload") == -1
                && requestedURI.indexOf("fileupload") == -1) {
            // replace first context
            String tmp1 = tmp.replaceFirst("/", "");
            int end = tmp1.indexOf("/");
            if (end > -1) {
                customWarContext = tmp1.substring(0, end);
                // one can rename the war file as 'registry'.
                // This will conflict with our internal 'registry' context
                if (!(requestedURI.startsWith("/registry/registry/"))
                        && !(requestedURI.startsWith("/registry/carbon/"))
                        && (customWarContext.equals("registry")
                        || customWarContext.equals("gadgets") || customWarContext
                        .equals("social"))) {
                    requestedURI = tmp;
                } else {
                    requestedURI = tmp.substring(end + 1);
                }
            }
        }

        // Disabling http access to admin console
        // user guide documents should be allowed to access via http protocol
        if (!request.isSecure() && !(requestedURI.endsWith(".html"))) {

            // by passing items required for try-it & IDE plugins
            if (requestedURI.endsWith(".css") || requestedURI.endsWith(".gif")
                    || requestedURI.endsWith(".GIF") || requestedURI.endsWith(".jpg")
                    || requestedURI.endsWith(".JPG") || requestedURI.endsWith(".png")
                    || requestedURI.endsWith(".PNG") || requestedURI.endsWith(".xsl")
                    || requestedURI.endsWith(".xslt") || requestedURI.endsWith(".js")
                    || requestedURI.endsWith(".ico") || requestedURI.endsWith("/filedownload")
                    || requestedURI.endsWith("/fileupload")
                    || requestedURI.indexOf("/fileupload/") > -1
                    || requestedURI.indexOf("admin/jsp/WSRequestXSSproxy_ajaxprocessor.jsp") > -1
                    || requestedURI.indexOf("registry/atom") > -1
                    || requestedURI.indexOf("registry/tags") > -1
                    || requestedURI.indexOf("gadgets/") > -1
                    || requestedURI.indexOf("registry/resource") > -1) {
                return true;
            }

            String resourceURI = requestedURI.replaceFirst("/carbon/", "../");

            // bypassing the pages which are specified as bypass https
            if (httpUrlsToBeByPassed.containsKey(resourceURI)) {
                if (!authenticated) {
                    try {
                        Cookie[] cookies = request.getCookies();
                        if (cookies != null) {
                            for (Cookie cookie : cookies) {
                                if (cookie.getName().equals(CarbonConstants.REMEMBER_ME_COOKE_NAME)) {
                                    if (getAuthenticator(request).reAuthenticateOnSessionExpire(request)) {
                                        String cookieValue = cookie.getValue();
                                        CarbonUIAuthenticationUtil.onSuccessAdminLogin(request,
                                                getUserNameFromCookie(cookieValue));
                                    }
                                }
                            }
                        }
                    } catch (Exception e) {
                        log.error(e.getMessage(), e);
                        throw new IOException(e.getMessage(), e);
                    }
                }
                return true;
            }

            String adminConsoleURL = CarbonUIUtil.getAdminConsoleURL(request);
            if (adminConsoleURL != null) {
                if (log.isTraceEnabled()) {
                    log.trace("Request came to admin console via http.Forwarding to : "
                            + adminConsoleURL);
                }
                response.sendRedirect(adminConsoleURL);
                return false;
            }
        }

        String resourceURI = requestedURI.replaceFirst("/carbon/", "../");

        if (log.isDebugEnabled()) {
            log.debug("CarbonSecuredHttpContext -> handleSecurity() requestURI:" + requestedURI
                    + " id:" + sessionId + " resourceURI:" + resourceURI);
        }

        // retrieve urls that should be by-passed from security check
        HashMap<String, String> urlsToBeByPassed = new HashMap<String, String>();
        if (bundle != null) {
            ServiceReference reference = bundle.getBundleContext().getServiceReference(
                    CarbonUIDefinitions.class.getName());
            CarbonUIDefinitions carbonUIDefinitions;
            if (reference != null) {
                carbonUIDefinitions = (CarbonUIDefinitions) bundle.getBundleContext().getService(
                        reference);
                if (carbonUIDefinitions != null) {
                    urlsToBeByPassed = carbonUIDefinitions.getUnauthenticatedUrls();
                    /*
                     * if(log.isDebugEnabled()){ Iterator<String> itr =
                     * urlsToBeByPassed.keySet().iterator();
                     * while(itr.hasNext()){
                     * log.debug("Should bypass url : "+itr.next()); } }
View Full Code Here

                    CarbonUIUtil.getAdminConsoleURL(serverConfiguration.getFirstProperty("WebContextRoot"));

            //Retrieving available contexts
            Context defaultContext = null;
            ServiceReference reference = ctxt.getBundleContext().getServiceReference(CarbonUIDefinitions.class.getName());
            CarbonUIDefinitions carbonUIDefinitions = null;
            if (reference != null) {
                carbonUIDefinitions =
                        (CarbonUIDefinitions) ctxt.getBundleContext().getService(reference);
                if (carbonUIDefinitions != null) {
                    if (carbonUIDefinitions.getContexts().containsKey("default-context")) {
                        defaultContext = carbonUIDefinitions.getContexts().get("default-context");
                    }

                }
            }
View Full Code Here

        ConfigurationContext configContext =
                getConfigurationContextService().getClientConfigContext();

        ServerConfiguration serverConfig = getServerConfiguration();

        CarbonUIDefinitions carbonUIDefinitions = new CarbonUIDefinitions();
        context.registerService(CarbonUIDefinitions.class.getName(), carbonUIDefinitions, null);

        // create a CustomUIDefinitions object and set it as a osgi service. UIBundleDeployer can access this
        // service and populate it with custom UI definitions of the deployed UI bundle, if available.
        CustomUIDefenitions customUIDefenitions = new CustomUIDefenitions();
View Full Code Here

                setDefaultMenus(loggedInUserName, isSuperTenant, userPermission, request);
            }
           
        String filtered = (String)request.getSession().getAttribute(MenuAdminClient.USER_MENU_ITEMS_FILTERED);
        if("false".equals(filtered)){
          CarbonUIDefinitions o = new CarbonUIDefinitions();
          Menu[] filteredMenus = o.getMenuDefinitions(loggedInUserName, isSuperTenant, userPermission, request, menus);
          menus = null;
          menus = filteredMenus;
          request.getSession().setAttribute(USER_MENU_ITEMS,menus);
        }
        if(menus != null){
View Full Code Here

                                 ArrayList<String> userPermission,
                                 HttpServletRequest request) {
        BundleContext bundleContext = CarbonUIUtil.getBundleContext();
        if (bundleContext != null) {
            ServiceReference reference = bundleContext.getServiceReference(CarbonUIDefinitions.class.getName());
            CarbonUIDefinitions carbonUIDefinitions;
            if (reference != null) {
                carbonUIDefinitions = (CarbonUIDefinitions) bundleContext.getService(reference);
                menus = carbonUIDefinitions.getMenuDefinitions(loggedInUserName,
                            isSuperTenant, userPermission,request);
                if (menus != null) {
                  if (log.isDebugEnabled()) {
                        log.debug("Found exiting menu items in OSGI context");
                    }
View Full Code Here

        Component component = ComponentBuilder.build(bundle, bundleContext);
        if (component == null) {
            return;
        } else {
            ServiceReference reference = bundleContext.getServiceReference(CarbonUIDefinitions.class.getName());
            CarbonUIDefinitions carbonUIDefinitions = null;
            if (reference != null) {
                carbonUIDefinitions = (CarbonUIDefinitions) bundleContext.getService(reference);
            }
            if (carbonUIDefinitions != null) {
                if (log.isDebugEnabled()) {
                    log.debug("Found carbonUIDefinitions in OSGi context");
                }
                carbonUIDefinitions.setMenuDefinitions(component.getMenus(), action);
                carbonUIDefinitions.setServletDefinitions(component.getServlets(), action);
                carbonUIDefinitions.addUnauthenticatedUrls(component.getUnauthenticatedUrlList());
                carbonUIDefinitions.addSkipTilesUrls(component.getSkipTilesUrlList());
                carbonUIDefinitions.addHttpUrls(component.getSkipHttpsUrlList());
                carbonUIDefinitions.addContexts(component.getContextsList());
            } else {
                if (log.isDebugEnabled()) {
                    log.debug("CarbonUIDefinitions is NULL. Registering new...");
                }
                carbonUIDefinitions = new CarbonUIDefinitions();
                carbonUIDefinitions.setMenuDefinitions(component.getMenus(), action);
                carbonUIDefinitions.setServletDefinitions(component.getServlets(), action);
                carbonUIDefinitions.addUnauthenticatedUrls(component.getUnauthenticatedUrlList());
                carbonUIDefinitions.addSkipTilesUrls(component.getSkipTilesUrlList());
                carbonUIDefinitions.addHttpUrls(component.getSkipHttpsUrlList());
                carbonUIDefinitions.addContexts(component.getContextsList());
                bundleContext.registerService(CarbonUIDefinitions.class.getName(), carbonUIDefinitions, null);
            }
        }

        //processing servlet definitions
View Full Code Here

    private void populatehttpUrlsToBeByPassed() {
        if (bundle != null && httpUrlsToBeByPassed.isEmpty() && defaultContext == null) {
            @SuppressWarnings("rawtypes")
            ServiceReference reference = bundle.getBundleContext().getServiceReference(
                    CarbonUIDefinitions.class.getName());
            CarbonUIDefinitions carbonUIDefinitions;
            if (reference != null) {
                carbonUIDefinitions = (CarbonUIDefinitions) bundle.getBundleContext().getService(
                        reference);
                if (carbonUIDefinitions != null) {
                    httpUrlsToBeByPassed = carbonUIDefinitions.getHttpUrls();
                    if (carbonUIDefinitions.getContexts().containsKey("default-context")) {
                        defaultContext = carbonUIDefinitions.getContexts().get("default-context");
                    }

                }
            }
        }
View Full Code Here

TOP

Related Classes of org.wso2.carbon.ui.deployment.beans.CarbonUIDefinitions

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.