14 Replies Latest reply on Aug 19, 2008 6:20 AM by Antoine Herzog

    Url : how to define MyPortal as the default portal.

    Antoine Herzog Master

      Hello,

      I want to have url like :

      http://localhost:8080/mycontextroot/myportalobjcommandprefix/mydefaultportal ...


      instead of http://localhost:8080/portal/portal/default

      I have changed the "mycontextroot/myportalobjcommandprefix/". That's ok.

      The question is : Is there a way to define the "default portal", to mydefaultportal ?
      the one return by
      PortalObjectImpl.getDefaultChild()


      The default portal is defined in : \deploy\jboss-portal.sar\conf\data\default-object.xml

      but... when I change the name of this portal, in this file, I get an exception :
      java.lang.IllegalStateException: Default portal does not exist
       at org.jboss.portal.core.model.portal.DefaultPortalCommandFactory.doMapping(DefaultPortalCommandFactory.java:76)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)


      just changing the name, nothing else, empty the portal object table in db... and retry : http://localhost:8080/mycontextroot/

      It seems that the name of the default portal is hard coded ?

      Any idea about this ?

      Shall I open a Jira to have the feature of defining the name of the default portal ?



        • 1. Re: Url : how to define MyPortal as the default portal.
          Antoine Herzog Master

          ok, in PortalObjectImpl there is :

          /**
           * Return the default child of this object based on the declared property that specifies the default
           * object name.
           */
           protected PortalObject getDefaultChild()
           {
           String portalName = getDeclaredProperty(PORTAL_PROP_DEFAULT_OBJECT_NAME);
           if (portalName == null)
           {
           portalName = DEFAULT_OBJECT_NAME;
           }
           return getChild(portalName);
           }
          
          

          so, when not found, it gets the "default" name from interface PortalObject.DEFAULT_OBJECT_NAME.

          where can be put the PORTAL_PROP_DEFAULT_OBJECT_NAME property, for defining the default portal among multiple portals instances ?

          ie : in what descriptor and where put the xml item portal.defaultObjectName ?
          <property>
           <name>portal.defaultObjectName</name>
           <value>MyDefaultPortalName</value>
           </property>
          


          I haven't seen in the JSR-168 anything about managing multiple portals.

          open a jira ?


          • 2. Re: Url : how to define MyPortal as the default portal.
            Thomas Heute Master

            It is at context level, AFAIK you cannot modify it with the XML descriptors.

            I don't think there is a Jira for this yet, so you can open one.

            (JSR 168, is defining the portlet container, so it has no notion of portals neither page, it's vendor specific)

            • 3. Re: Url : how to define MyPortal as the default portal.
              Antoine Herzog Master

              Opened a jira :
              http://jira.jboss.com/jira/browse/JBPORTAL-1324

              There is in the jira the code of an overidding class of org.jboss.portal.core.model.portal.DefaultPortalCommandFactory

              to replace the service

              name="portal:commandFactory=DefaultPortal"


              It mainly bypass the code : Portal portal = ctx.getDefaultPortal();
              to set it with the configurable attribute
              <attribute name="DefaultPortalName">MyDefaultPortalName</attribute>

              of the jmx service.

              • 4. Re: Url : how to define MyPortal as the default portal.
                Sovanna Non Newbie

                Hi,

                I face the same issue with the JBoss Portal 2.4.1 :
                when I navigate to a specific page in my portal I have the error :
                "java.lang.IllegalStateException: Default portal does not exist"

                Since I have 2 portail instances, I'm trying to set one of them as the default portal, but I don't know what file contains the "jmx service descriptor" and where to put exactly the following code :

                <!-- Default portal name : "default" is the default for native jboss portal (downloaded version). -->
                MyDefaultPortalNameHere

                Any idea about this ?

                • 5. Re: Url : how to define MyPortal as the default portal.
                  narinder bansal Newbie

                  please explain how to set myportal as default portal. i am not able to find any any jmx service xml descriptor file which contains this attribute.
                  MyDefaultPortalName

                  • 6. Re: Url : how to define MyPortal as the default portal.
                    Antoine Herzog Master

                    The JMX service description is :

                    <mbean
                     code="org.jboss.portal.core.model.portal.DefaultPortalCommandFactory"
                     name="portal:commandFactory=DefaultPortal"
                     xmbean-dd=""
                     xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
                     <xmbean/>
                     <depends
                     optional-attribute-name="NextFactory"
                     proxy-type="attribute">portal:commandFactory=Delegating</depends>
                     <depends
                     optional-attribute-name="Container"
                     proxy-type="attribute">portal:container=PortalObject</depends>
                     </mbean>
                    


                    it is in : deploy\jboss-portal.sar\META-INF\jboss-service.xml

                    you have to replace the JMX service, by one of your own, with the class overriden for your need.

                    look at the Jira for an example of the code :
                    http://jira.jboss.com/jira/browse/JBPORTAL-1324

                    and, please, vote for the jira task... so it shows that some people wish to have this feature in the future version....


                    • 7. Re: Url : how to define MyPortal as the default portal.
                      Thomas Heute Master



                      On the admin GUI, just click on "Make default".
                      In the XML i don't remember the syntax by heart, but that shouldn't be hard to find.

                      (The Jira is closed as resolved, no need to vote for it)

                      • 8. Re: Url : how to define MyPortal as the default portal.
                        narinder bansal Newbie

                        hi i am working on jboss-portal-2.6.5.SP1
                        the class ConfigurableDefaultPortalCommandFactory mentioned on jira( https://jira.jboss.org/jira/browse/JBPORTAL-1324 ), for making a portal default, is not working.
                        i know we can set a portal as default from admin GUI
                        but could anyone please explain how to do this through code.
                        where and how to define attribute in jboss-service.xml for making my portal, a defaultportal

                        thanks in advance

                        • 9. Re: Url : how to define MyPortal as the default portal.
                          Antoine Herzog Master

                          Hello,

                          I don't remember exactly what I did for the class in the jira.
                          I surely modified it to provide it to the portal.
                          mine is a little bit different, for specific thing of my portal.

                          however, here the main part of the code of it, that must be changed.
                          this is working in my portal, with JBP 2.6.4.

                          // orginal code : Portal portal = ctx.getDefaultPortal();
                           PortalObject portalObject = ctx.getChild(getDefaultPortalName());
                           if (portalObject == null) {
                           throw new IllegalStateException(
                           "PortalObject as Default Portal is not found. Default Portal name is defined to : "
                           + getDefaultPortalName());
                           }
                           Portal portal = null;
                           if (portalObject instanceof Portal) {
                           portal = (Portal) portalObject;
                           } else {
                           throw new IllegalStateException(
                           "Can't find PortalObject with default portal name : "
                           + getDefaultPortalName());
                           }
                          // (.... here the rest of the code of the method)
                          


                          The whole class is quite simple.
                          the thing to do (modify) is to find the default portal from the name you want, and then make the same process as the original class, with that "portal" instance.

                          look at the code and make it work your way.
                          that the most simple thing I believe I can tell for helping you do it.

                          hope it helps.


                          • 10. Re: Url : how to define MyPortal as the default portal.
                            Jean-Etienne LaVallee Newbie

                             

                            "thomas.heute@jboss.com" wrote:
                            It is at context level, AFAIK you cannot modify it with the XML descriptors.

                            I don't think there is a Jira for this yet, so you can open one.

                            (JSR 168, is defining the portlet container, so it has no notion of portals neither page, it's vendor specific)


                            I've got a largely empty WAR called "myportal-topology.war" that has just a *-object.xml file in the WEB-INF called "myportal-topology-object.xml"...

                            The head of the file looks like this:
                            <?xml version="1.0" encoding="UTF-8"?>
                            <!DOCTYPE deployments PUBLIC
                             "-//JBoss Portal//DTD Portal Object 2.6//EN"
                             "http://www.jboss.org/portal/dtd/portal-object_2_6.dtd">
                            <deployments>
                             <deployment>
                             <context>
                             <context-name/>
                             <properties>
                             <property>
                             <name>portal.defaultObjectName</name>
                             <value>myportal</value>
                             </property>
                             </properties>
                             </context>
                             </deployment>
                             <deployment>
                             <parent-ref/>
                             <if-exists>overwrite</if-exists>
                             <portal>
                             <portal-name>myportal</portal-name>
                             <supported-modes>
                             <mode>view</mode>
                             <mode>edit</mode>
                             <mode>help</mode>
                             </supported-modes>
                             <supported-window-states>
                             <window-state>normal</window-state>
                             <window-state>minimized</window-state>
                             <window-state>maximized</window-state>
                             </supported-window-states>
                             <properties>
                            ...
                            


                            This deploys fine and populates the pages with the proper instances and all that jazz. Only problem is that it doesn't set the default PORTAL to "myportal".

                            I have the default page working no problem... just not the default portal...

                            How do I get this working? I've seen a number of folks asking this question and the answers always seem to be either telling them how to set the default page (wrong answer), or "I think it's somewhere in X but you can figure it out", or "use the admin portlet" (not an option for me since we're trying to make this an automated deployment process.

                            Thanks in advance,
                            Etienne


                            • 11. Re: Url : how to define MyPortal as the default portal.
                              Jean-Etienne LaVallee Newbie

                              Oh yeah... I'm on JBoss Portal 2.6.5.GA...

                              • 12. Re: Url : how to define MyPortal as the default portal.
                                Antoine Herzog Master

                                Hello Etienne,

                                I think it's somewhere in the forum but you can figure it out...

                                hem, joking...

                                For what I remember, the default portal object configuration in the xml ... is only for the default page of a portal. but not the default portal.

                                to change the default portal, you have to modify one of the JMX Service of the portal.

                                See my post above, of Wed Mar 21, 2007 (that's why my "I think it's somewhere in ...")
                                it explain how to do it, and see the JIRA about it
                                https://jira.jboss.org/jira/browse/JBPORTAL-1324
                                There, you'll find the code for modify the JMX service.

                                it is a very simple modification of the JMX (overriding the class).
                                Then, you just have to comment the original JMX Service in the jboss-service.xml file of the portal, and deploy your own Sar with your service (with the same name). The portal will use your service.

                                I use JBP 2.6.1GA, and the modification of the portal code it is not yet there. May be it is in 2.6.5.
                                I will reopen the Jira so this thing can be done in a future version...

                                feel free to call me on the phone, me via my signature info, if you need more details or talking about it.

                                • 13. Re: Url : how to define MyPortal as the default portal.
                                  Jean-Etienne LaVallee Newbie

                                  Antoine,

                                  Nice...

                                  I'm already doing some tweaks to jboss-service.xml, so this will just be another tweak in our deployment scripts.

                                  Thanks for getting back to me on it... would definitely be a great feature for *-object.xml.

                                  Along a similar path, I'm finding that I can't apply policy permissions at the portlet-window level in *-object.xml. Do you happen to know if this is a feature, bug or possibly point me to a more definitive example than my current experimentation w/ the DTD as a reference?

                                  I haven't even started digging on that one... just figured I'd ask... ;^)

                                  Thanks for the help,
                                  ciao,
                                  Etienne

                                  • 14. Re: Url : how to define MyPortal as the default portal.
                                    Antoine Herzog Master

                                    Hi,

                                    yes... there are oftenly things to change on the jboss-service.xml.

                                    for deployement, I will soon use : http://buildprocess.sourceforge.net/
                                    the autoDeploy module looks good for that.
                                    it provide a good base tool for reliable deployements... and not to write a lot of scripting oneself.
                                    the project is young, but it is good.

                                    this will allow to help and make it reliable, when upgrading the portal etc...

                                    *****************
                                    I don't know when (if) the feature will be added...
                                    and the one by programming is ok for me.
                                    done once, used since... not a big deal... and may be better for performance.
                                    by the way, you won't change de default portal many times... may be never....

                                    ******************
                                    I don't remember exactly about the window policy permission (long time I looked at this...).
                                    I remember you can do it with the instances of portlet.
                                    and if i remember well, the instance is most of the time related directly to the window.
                                    unless you have two window with the same instance... which means the same thing in two windows.... unless you really need two window for I don't know what purpose, then can be done with an other way... with only one windows... reused in several pages etc...

                                    seems simple... I hope I am not mistaking when answering too quickly.

                                    may be post on a new post for more answers...