Package org.jasig.portal

Examples of org.jasig.portal.PortalException


            // reload
            Throwable errorThrowable = this.errorDocument.getThrowable();
            if (errorThrowable != null
                    && errorThrowable instanceof PortalException) {

                PortalException portalException = (PortalException) errorThrowable;

                policy.allowRefresh = portalException.isRefreshable();
                policy.allowReinstantiation = portalException.isReinstantiable();
               
                if (log.isTraceEnabled()){
                    log.trace("PortalException [" + portalException +
                            "] implied refresh policy [" + policy + "]");
                }
View Full Code Here


        {
            ID = getDLS().getNextStructDirectiveId( person );
        }
        catch (Exception e)
        {
            throw new PortalException( "Exception encountered while " +
                                       "generating new parameter edit set node " +
                                       "Id for userId=" + person.getID(), e );
        }
        Element parmSet = plf.createElement( Constants.ELM_PARM_SET );
        parmSet.setAttribute( Constants.ATT_TYPE,
View Full Code Here

        {
            ID = getDLS().getNextStructDirectiveId( person );
        }
        catch (Exception e)
        {
            throw new PortalException( "Exception encountered while " +
                                       "generating new parameter edit node " +
                                       "Id for userId=" + person.getID(), e );
        }
        Element parm = plf.createElement( Constants.ELM_PARM_EDIT );
        parm.setAttribute( Constants.ATT_TYPE, Constants.ELM_PARM_EDIT );
View Full Code Here

        }
        else {
            isOK = false;
        }
        if (!isOK) {
            throw  (new PortalException("CPermissionsServantFactory.getPermissionsServant():: unable to properly initialize servant, check that mast staticData is being properly passed to this method"));
        }
        if (log.isInfoEnabled()) {
            long time2 = Calendar.getInstance().getTime().getTime();
            log.info( "CPermissionsManagerFactory took  "
                    + String.valueOf((time2 - time1)) + " ms to instantiate");
View Full Code Here

        try {
            // get /users context
            usersContext = (Context) jndiTemplate.lookup("/users", Context.class);
        }
        catch (NamingException ne) {
            final PortalException portalException = new PortalException("Could not find /users context", ne);
            this.logger.error(portalException.getMessage(), ne);
            throw portalException;
        }

        // get or create /users/[userId] context
        Context userIdContext = null;
        Context sessionsContext = null;
        Context layoutsContext = null;
        try {
            userIdContext = (Context) usersContext.lookup(userId);

            // lookup layouts and sessions contexts
            try {
                layoutsContext = (Context) userIdContext.lookup("layouts");
            }
            catch (NamingException ne) {
                this.logger.warn("The '/users/" + userId + "/layouts' Context did not exist, even though the '/users/" + userId + "' Context did. It will be created.");
                layoutsContext = userIdContext.createSubcontext("layouts");
            }

            try {
                sessionsContext = (Context) userIdContext.lookup("sessions");
            }
            catch (NamingException ne) {
                this.logger.error("The Context '/users/" + userId + "/sessions' did not exist, even though the '/users/" + userId + "' Context did. It will be created.");
                sessionsContext = userIdContext.createSubcontext("sessions");
            }

        }
        catch (NamingException ne) {
            // new user
            try {
                userIdContext = usersContext.createSubcontext(userId);
               
                // create layouts and sessions context
                layoutsContext = userIdContext.createSubcontext("layouts");
                sessionsContext = userIdContext.createSubcontext("sessions");
               
                if (this.logger.isDebugEnabled()) {
                    this.logger.debug("Created and initialized Contexts for a userId='" + userId + "'");
                }
            }
            catch (NamingException ne2) {
                final PortalException portalException = new PortalException("exception encountered while trying to create  '/users/" + userId + "' and layouts/sessions Contexts", ne2);
                this.logger.error(portalException.getMessage(), ne2);
                throw portalException;
            }
        }

        // bind sessions/[sessionId] context
        final Context sessionIdContext;
        try {
            sessionIdContext = sessionsContext.createSubcontext(sessionId);
        }
        catch (NameAlreadyBoundException nabe) {
            final PortalException portalException = new PortalException("A session context is already bound at '/users/" + userId + "/sessions/" + sessionId + "'", nabe);
            this.logger.error(portalException.getMessage(), nabe);
            throw portalException;
        }
        catch (NamingException ne) {
            final PortalException portalException = new PortalException("Excpetion encountered while trying to create Context '/users/" + userId + "/sessions/" + sessionId + "'", ne);
            this.logger.error(portalException.getMessage(), ne);
            throw portalException;
        }

        // bind layoutId
        try {
            sessionIdContext.bind("layoutId", layoutId);
        }
        catch (NamingException ne) {
            final PortalException portalException = new PortalException("Excpetion encountered while trying to bind '" + layoutId + "' to '/users/" + userId + "/sessions/" + sessionId + "/layoutId'", ne);
            this.logger.error(portalException.getMessage(), ne);
            throw portalException;
        }

        // make sure channel-obj context exists
        try {
            sessionIdContext.createSubcontext("channel-obj");
        }
        catch (NameAlreadyBoundException nabe) {
            // ignore
        }
        catch (NamingException ne) {
            this.logger.warn("Excpetion encountered while create Context '" + layoutId + "' to '/users/" + userId + "/sessions/" + sessionId + "/channel-obj', this will be ignored.", ne);
        }

        // check if the layout id binding already exists
        try {
            //Check if layouts/[layoutId]/ alread exists
            layoutsContext.lookup(layoutId);
           
            // assume layouts/[layoutId]/ has already been populated

            // bind layouts/[layoutId]/sessions/[sessionId]
            final Context layoutSessionsContext;
            try {
                layoutSessionsContext = (Context) userIdContext.lookup("layouts/" + layoutId + "/sessions");
            }
            catch (NamingException ne) {
                final PortalException portalException = new PortalException("Exception occured while looking up Context '/users/" + userId + "/layouts/" + layoutId + "/sessions/' even though Context '/users/" + userId + "/layouts' already existed.", ne);
                this.logger.error(portalException.getMessage(), ne);
                throw portalException;
            }
           
            try {
                layoutSessionsContext.createSubcontext(sessionId);

                if (this.logger.isDebugEnabled()) {
                    this.logger.debug("Created Context '/users/" + userId + "/layouts/" + layoutId + "/sessions/" + sessionId + "'");
                }
            }
            catch (NamingException ne) {
                final PortalException portalException = new PortalException("Exception occured while creating Context '/users/" + userId + "/layouts/" + layoutId + "/sessions/" + sessionId + "'", ne);
                this.logger.error(portalException.getMessage(), ne);
                throw portalException;
            }
        }
        catch (NamingException ne) {
            final Context layoutIdContext;
            try {
                // given layout id has not been registered yet
                layoutIdContext = layoutsContext.createSubcontext(layoutId);
   
                // bind layouts/[layoutId]/sessions/[sessionId] context
                final Context layoutSessionsContext = layoutIdContext.createSubcontext("sessions");
                layoutSessionsContext.createSubcontext(sessionId);
   
                if (this.logger.isDebugEnabled()) {
                    this.logger.debug("Created Context '/users/" + userId + "/layouts/" + layoutId + "'");
                }
            }
            catch (NamingException ne2) {
                final PortalException portalException = new PortalException("Exception occured while creating the '/users/" + userId + "/layouts/" + layoutId + "' Context.", ne2);
                this.logger.error(portalException.getMessage(), ne2);
                throw portalException;
            }
           
            try {
                final Context channel_idsContext = layoutIdContext.createSubcontext("channel-ids");
               
               
                // Get the list of channels in the user's layout
                final NodeList channelNodes = userLayout.getElementsByTagName("channel");
                // Parse through the channels and populate the JNDI
                for (int channelNodeIndex = 0; channelNodeIndex < channelNodes.getLength(); channelNodeIndex++) {
                    // Attempt to get the fname and instance ID from the channel
                    final Node channelNode = channelNodes.item(channelNodeIndex);
                    final NamedNodeMap channelAttributes = channelNode.getAttributes();
                   
                    final Node fname = channelAttributes.getNamedItem("fname");
                    final Node instanceId = channelAttributes.getNamedItem("ID");
                    if (fname != null && instanceId != null) {
                        //System.out.println("fname found -> " + fname);
                        // Create a new composite name from the fname
                        final CompositeName cname = new CompositeName(fname.getNodeValue());
                       
                        // Get a list of the name components
                        final Enumeration<String> subContextNameEnum = cname.getAll();
                        // Get the root of the context
                        Context nextContext = channel_idsContext;
                        // Add all of the subcontexts in the fname
                        while (subContextNameEnum.hasMoreElements()) {
                            final String subContextName = subContextNameEnum.nextElement();
                            if (subContextNameEnum.hasMoreElements()) {
                                // Bind a new sub context if the current name component is not the leaf
                                nextContext = nextContext.createSubcontext(subContextName);
                            }
                            else {
                                nextContext.rebind(subContextName, instanceId.getNodeValue());
                               
                                if (this.logger.isDebugEnabled()) {
                                    this.logger.debug("Bound channel id '" + instanceId.getNodeValue() + "' to '" + nextContext.getNameInNamespace() + "/" + subContextName + "'");
                                }
                            }
                        }
                    }
                }
            }
            catch (NamingException ne2) {
                final PortalException portalException = new PortalException("Exception occured while creating or populating the '/users/" + userId + "/layouts/" + layoutId + "/channel-ids' Context.", ne2);
                this.logger.error(portalException.getMessage(), ne2);
                throw portalException;
            }
        }
       
        this.logger.info("JNDI Context configured for sessionId='" + sessionId + "', userId='" + userId + "', and layoutId='" + layoutId + "'");
View Full Code Here

        try {
            // get /users context
            usersContext = (Context) jndiTemplate.lookup("/users", Context.class);
        }
        catch (NamingException ne) {
            final PortalException portalException = new PortalException("Could not find /users context", ne);
            this.logger.error(portalException.getMessage(), ne);
            throw portalException;
        }
       
        //No context, nothing to do
        if (usersContext == null) {
View Full Code Here

      if (mimeType.equals("text/html"))
        filter = new CWebProxyXHTMLURLFilter(handler);
      else if (mimeType.equals("text/vnd.wap.wml"))
        filter = new CWebProxyWMLURLFilter(handler);
      else
        throw new PortalException("CWebProxyURLFilter.newCWebProxyURLFilter(): Unable to locate CWebProxyURLFilter for mime type '" + mimeType + "'");
    }
    else
    {
      throw new PortalException("CWebProxyURLFilter.newCWebProxyURLFilter(): Unable to create CWebProxyURLFilter. Mime type is null.");
    }

    // Set CWebProxyURLFilter properties
    filter.runtimeData = runtimeData;
    filter.baseUrl = (String)runtimeData.get("cw_xml");
View Full Code Here

                    + "' for extracting a CAR resource.");
            out = new FileOutputStream(destination);
        }
        catch (Exception e)
        {
            throw new PortalException(
                "Unable to open file '" + destination.getAbsolutePath() + "'.",
                e);
        }
        byte[] bytes = new byte[4096];
        int bytesRead;

        try
        {
            InputStream in = jar.getInputStream(z);
            bytesRead = in.read(bytes);
            while (bytesRead != -1)
            {
                out.write(bytes, 0, bytesRead);
                bytesRead = in.read(bytes);
            }
            in.close();
            out.flush();
            out.close();
        }
        catch (IOException e)
        {
            throw new PortalException(
                "Unable to extract content of '"
                    + z.getName()
                    + "' in CAR '"
                    + jar.getName()
                    + "'.",
View Full Code Here

                    + "' for extracting a CAR resource.");
            return new File(fullName);
        }
        catch (Exception e)
        {
            throw new PortalException(
                "Unable to open file '" + filePath + "'.",
                e);
        }
    }
View Full Code Here

        {
            jar = new JarFile(car);
        }
        catch (IOException e)
        {
            throw new PortalException(
                "Unable to open CAR '" + carFileFullPath + "'." + e);
        }
        return jar;
    }
View Full Code Here

TOP

Related Classes of org.jasig.portal.PortalException

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.