mcardle     2005/12/07 17:33:05 CET

  Modified files:
    core/src/java/org/jahia/aop EsiJspContentDetectionAspect.java 
  Log:
  * catches JahiaFieldSet events

  * deals more gracefully with potential aop errors
  
  Revision  Changes    Path
  1.8       +246 -227  
jahia/core/src/java/org/jahia/aop/EsiJspContentDetectionAspect.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/java/org/jahia/aop/EsiJspContentDetectionAspect.java.diff?r1=1.7&r2=1.8&f=h
  
  
  
  Index: EsiJspContentDetectionAspect.java
  ===================================================================
  RCS file: 
/home/cvs/repository/jahia/core/src/java/org/jahia/aop/EsiJspContentDetectionAspect.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- EsiJspContentDetectionAspect.java 1 Dec 2005 15:30:49 -0000       1.7
  +++ EsiJspContentDetectionAspect.java 7 Dec 2005 16:33:04 -0000       1.8
  @@ -34,95 +34,101 @@
       /**
        *  Aspect which detects access to a ContainerList (usually from JSP 
pages or tags)
        * and adds its ID to the closest enclosing ESI object (e.g. Fragment or 
Template)
  -      * @param joinPoint
  +     * @param joinPoint
        * @throws Throwable
        */
       public void addContainerList (JoinPoint joinPoint)
  -       throws Throwable {
  +            throws Throwable {
           Object obj = joinPoint.getCallee();
           if (obj instanceof ContainerListBean)
  -           addContent(joinPoint, (ContainerListBean)obj, 
"ContainerListBean","addContainerList");
  +            addContent(joinPoint, (ContainerListBean)obj, 
"ContainerListBean","addContainerList");
           else if (obj instanceof JahiaContainerList)
               addContent(joinPoint, (JahiaContainerList)obj, 
"JahiaContainerList","addContainerList");
           else if (obj instanceof ContentContainerList)
               addContent(joinPoint, (ContentContainerList)obj, 
"ContentContainerList","addContainerList");
       }
       /**
  -      *  Aspect which detects access to a Container (usually from JSP pages 
or tags)
  -      * and adds its ID to the closest enclosing ESI object (e.g. Fragment 
or Template)
  -       * @param joinPoint
  -      * @throws Throwable
  +     *  Aspect which detects access to a Container (usually from JSP pages 
or tags)
  +     * and adds its ID to the closest enclosing ESI object (e.g. Fragment or 
Template)
  +     * @param joinPoint
  +     * @throws Throwable
        */
   
       public void addContainer (JoinPoint joinPoint)
  -         throws Throwable {
  -          Object obj = joinPoint.getCallee();
  -          if (obj instanceof ContainerBean)
  -             addContent(joinPoint, (ContainerBean)obj, 
"ContainerBean","addContainer");
  -          else if (obj instanceof JahiaContainer)
  -              addContent(joinPoint, (JahiaContainer)obj, 
"JahiaContainer","addContainer");
  -          else if (obj instanceof ContentContainer)
  -              addContent(joinPoint, (ContentContainer)obj, 
"ContentContainer","addContainer");
  -          else if (verbose) System.err.println("           addContainer : 
UNKNOWN OBJECT TYPE: "+ obj);
  -      }
  +            throws Throwable {
  +        Object obj = joinPoint.getCallee();
  +        if (obj instanceof ContainerBean)
  +            addContent(joinPoint, (ContainerBean)obj, 
"ContainerBean","addContainer");
  +        else if (obj instanceof JahiaContainer)
  +            addContent(joinPoint, (JahiaContainer)obj, 
"JahiaContainer","addContainer");
  +        else if (obj instanceof ContentContainer)
  +            addContent(joinPoint, (ContentContainer)obj, 
"ContentContainer","addContainer");
  +        else if (verbose) System.err.println("           addContainer : 
UNKNOWN OBJECT TYPE: "+ obj);
  +    }
       /**
  -      *  Aspect which detects access to a Field (usually from JSP pages or 
tags)
  -      * and adds its ID to the closest enclosing ESI object (e.g. Fragment 
or Template)
  -       * @param joinPoint
  -      * @throws Throwable
  -      */
  +     *  Aspect which detects access to a Field (usually from JSP pages or 
tags)
  +     * and adds its ID to the closest enclosing ESI object (e.g. Fragment or 
Template)
  +     * @param joinPoint
  +     * @throws Throwable
  +     */
       public void addField (JoinPoint joinPoint)
  -    throws Throwable {
  -     Object obj = joinPoint.getCallee();
  -     if (obj instanceof FieldBean)
  -        addContent(joinPoint, (FieldBean)obj, "FieldBean","addField");
  -     else if (obj instanceof JahiaField)
  -         addContent(joinPoint, (JahiaField)obj, "JahiaField","addField");
  -     else if (obj instanceof ContentField)
  -         addContent(joinPoint, (ContentField)obj, "ContentField","addField");
  -     else if (verbose) System.err.println("           addField : UNKNOWN 
OBJECT TYPE: "+ obj);
  +            throws Throwable {
  +        Object obj = joinPoint.getCallee();
  +        if (obj instanceof FieldBean)
  +            addContent(joinPoint, (FieldBean)obj, "FieldBean","addField");
  +        else if (obj instanceof JahiaField)
  +            addContent(joinPoint, (JahiaField)obj, "JahiaField","addField");
  +        else if (obj instanceof ContentField)
  +            addContent(joinPoint, (ContentField)obj, 
"ContentField","addField");
  +        else if (verbose) System.err.println("           addField : UNKNOWN 
OBJECT TYPE: "+ obj);
       }
       /**
  -      *  Aspect which detects access to a Page (usually from JSP pages or 
tags)
  -      * and adds its ID to the closest enclosing ESI object (e.g. Fragment 
or Template)
  -       * @param joinPoint
  -      * @throws Throwable
  -      */
  +     *  Aspect which detects access to a Page (usually from JSP pages or 
tags)
  +     * and adds its ID to the closest enclosing ESI object (e.g. Fragment or 
Template)
  +     * @param joinPoint
  +     * @throws Throwable
  +     */
   
       public void addPage (JoinPoint joinPoint)
  -        throws Throwable {
  -         Object obj = joinPoint.getCallee();
  -         if (obj instanceof PageBean)
  +            throws Throwable {
  +        Object obj = joinPoint.getCallee();
  +        if (obj instanceof PageBean)
               addContent(joinPoint, (PageBean)obj, "PageBean","addPage");
  -         else if (obj instanceof JahiaPage)
  -             addContent(joinPoint, (JahiaPage)obj, "JahiaPage","addPage");
  -         else if (obj instanceof ContentPage)
  -             addContent(joinPoint, (ContentPage)obj, 
"ContentPage","addPage");
  -         else if (verbose) System.err.println("           addPage : UNKNOWN 
OBJECT TYPE: "+ obj);
  -     }
  +        else if (obj instanceof JahiaPage)
  +            addContent(joinPoint, (JahiaPage)obj, "JahiaPage","addPage");
  +        else if (obj instanceof ContentPage)
  +            addContent(joinPoint, (ContentPage)obj, "ContentPage","addPage");
  +        else if (verbose) System.err.println("           addPage : UNKNOWN 
OBJECT TYPE: "+ obj);
  +    }
   
       /**
  -      *  Aspect which detects a method which returns a Container (usually 
called from JSP pages or tags)
  -      * and adds its ID to the closest enclosing ESI object (e.g. Fragment 
or Template)
  -       * @param joinPoint
  +     *  Aspect which detects a method which returns a Container (usually 
called from JSP pages or tags)
  +     * and adds its ID to the closest enclosing ESI object (e.g. Fragment or 
Template)
  +     * @param joinPoint
        *   @param returnValue returned Container
  -      * @throws Throwable
  -      */
  +     * @throws Throwable
  +     */
       public void addContainerSET (JoinPoint joinPoint, 
org.jahia.data.containers.JahiaContainer returnValue)
  -        throws Throwable {
  -                    addContent(joinPoint, returnValue, 
"JahiaContainer","addContainerSET");
  -     }
  -
  -        /**
  -      *  Aspect which detects a method which returns a ContainerList 
(usually called from JSP pages or tags)
  -      * and adds its ID to the closest enclosing ESI object (e.g. Fragment 
or Template)
  -       * @param joinPoint
  +            throws Throwable {
  +        addContent(joinPoint, returnValue, 
"JahiaContainer","addContainerSET");
  +    }
  +
  +    /**
  +     *  Aspect which detects a method which returns a ContainerList (usually 
called from JSP pages or tags)
  +     * and adds its ID to the closest enclosing ESI object (e.g. Fragment or 
Template)
  +     * @param joinPoint
        *   @param returnValue returned ContainerList
  -      * @throws Throwable
  -      */
  +     * @throws Throwable
  +     */
       public void addContainerListSET (JoinPoint joinPoint, 
org.jahia.data.containers.JahiaContainerList returnValue)
  -       throws Throwable {
  -            addContent(joinPoint, returnValue, 
"JahiaContainerList","addContainerListSET");
  +            throws Throwable {
  +        addContent(joinPoint, returnValue, 
"JahiaContainerList","addContainerListSET");
  +    }
  +
  +
  +     public void jahiaFieldSET (JoinPoint joinPoint, 
org.jahia.data.fields.JahiaField returnValue)
  +            throws Throwable {
  +        addContent(joinPoint, returnValue, "JahiaField","jahiaFieldSET");
       }
   
       /**
  @@ -135,177 +141,190 @@
        * @throws Throwable
        */
       public static void addContent (final JoinPoint joinPoint, Object aspObj, 
final String ObjType , final String aspectName)
  -        throws Throwable {
  -        if (very_verbose) {
  -            MemberSignature signature = (MemberSignature) 
joinPoint.getSignature();
  +            throws Throwable {
  +        try {
   
  -            System.err.println(
  -                    "!!!!!!!!!!!!!!!!!!!!!!!!!! -------\n "+aspectName+" 
aspect: "
  -                            + joinPoint.getCalleeClass().getName() + "::"
  -                            + signature.getName() + "\n" + 
joinPoint.toString());
  -            System.err.println("-------\n aspObj: "+ aspObj);
  -        }
  +            if (very_verbose) {
  +                MemberSignature signature = (MemberSignature) 
joinPoint.getSignature();
   
  -        //Check to see if we are inside an Template/Fragment object, if not 
exit
  -        JesiObject jesiObj = null;
  -        try {
  -            jesiObj = (JesiObject) 
ServicesRegistry.getInstance().getEsiService().tagStackPeek();
  -        } catch(EmptyStackException ex) {
  -            if (verbose) System.err.println("     QUITTING 
EsiJspContentDetectionAspect."+aspectName+"() as OUTSIDE FRAGMENT OR TEMPLATE");
  -            return;
  -        }
  +                System.err.println(
  +                        "!!!!!!!!!!!!!!!!!!!!!!!!!! -------\n "+aspectName+" 
aspect: "
  +                                + joinPoint.getCalleeClass().getName() + "::"
  +                                + signature.getName() + "\n" + 
joinPoint.toString());
  +                System.err.println("-------\n aspObj: "+ aspObj);
  +            }
   
  -        if (very_verbose) {
  -            //System.err.println(aspectName+"[" + 
this.getClass().getClassLoader().hashCode() + "] ");
  -            //System.err.println(aspectName+" this[" + this + "] ");
  -
  -            MethodRtti mrtti = (MethodRtti) joinPoint.getRtti();
  -            System.err.println(" MethodRtti  
Method:"+mrtti.getMethod().toString());
  -            //    +" Return type:"+mrtti.getReturnType() );
  -            Object[] parameters = mrtti.getParameterValues();
  -            for (int i = 0, j = parameters.length; i < j; i++) {
  -                System.err.println("                param "+i+" 
Name:"+parameters[i]);
  +            //Check to see if we are inside an Template/Fragment object, if 
not exit
  +            JesiObject jesiObj = null;
  +            try {
  +                jesiObj = (JesiObject) 
ServicesRegistry.getInstance().getEsiService().tagStackPeek();
  +            } catch(EmptyStackException ex) {
  +                if (verbose) System.err.println("     QUITTING 
EsiJspContentDetectionAspect."+aspectName+"() as OUTSIDE FRAGMENT OR TEMPLATE");
  +                return;
               }
  -        }
  -        String contentType = null;
  -        int objID = -1;
   
  -        if (aspObj instanceof PageBean) {
  -            objID = ((PageBean) aspObj).getID();
  -            jesiObj.addPage(objID);
  -            jesiObj.addAclUserNames(((PageBean) aspObj).getACL());
  -            contentType = "PageBean";
  -        }
  -        else if (aspObj instanceof JahiaPage) {
  -            objID = ((JahiaPage) aspObj).getID();
  -            jesiObj.addPage(objID );
  -            jesiObj.addAclUserNames(((JahiaPage) aspObj).getACL());
  -            contentType = "JahiaPage";
  -        }
  -        else if (aspObj instanceof ContentPage) {
  -            objID = ((ContentPage) aspObj).getID();
  -            jesiObj.addPage(objID );
  -            jesiObj.addAclUserNames(((ContentPage) aspObj).getACL());
  -            contentType = "ContentPage";
  -        }
  -        else if (aspObj instanceof JahiaField) {
  -            objID = ((JahiaField) aspObj).getID();
  -            jesiObj.addField(objID );
  -            jesiObj.addAclUserNames(((JahiaField) aspObj).getACL());
  -            contentType = "JahiaField";
  -        }
  -        else if (aspObj instanceof FieldBean) {
  -            objID =((FieldBean) aspObj).getID();
  -            jesiObj.addField( objID );
  -            jesiObj.addAclUserNames(((FieldBean) aspObj).getACL());
  -            contentType = "FieldBean";
  -        }
  -        else if (aspObj instanceof ContentField) {
  -            objID =((ContentField) aspObj).getID();
  -            jesiObj.addField( objID );
  -            jesiObj.addAclUserNames(((ContentField) aspObj).getACL());
  -            contentType = "ContentField";
  -        }
  -        else if (aspObj instanceof JahiaContainer) {
  -            objID =((JahiaContainer) aspObj).getID();
  -            jesiObj.addContainer(objID);
  -            jesiObj.addAclUserNames(((JahiaContainer) aspObj).getACL());
  -            contentType = "JahiaContainer";
  -            int ctnListID = ((JahiaContainer) aspObj).getListID();
  -            addParentContainerList(ctnListID, jesiObj, aspectName, 
contentType, objID);
  -        }
  -        else if (aspObj instanceof ContainerBean) {
  -            objID =((ContainerBean) aspObj).getID();
  -            jesiObj.addContainer(objID);
  -            jesiObj.addAclUserNames(((ContainerBean) aspObj).getACL());
  -            contentType = "ContainerBean";
  -            int ctnListID = ((ContainerBean) aspObj).getContainerListID();
  -            addParentContainerList(ctnListID, jesiObj, aspectName, 
contentType, objID);
  -        }
  -        else if (aspObj instanceof ContentContainer) {
  -            objID =((ContentContainer) aspObj).getID();
  -            jesiObj.addContainer(objID);
  -            jesiObj.addAclUserNames(((ContentContainer) aspObj).getACL());
  -            contentType = "ContentContainer";
  -            int ctnListID = ((ContentContainer) 
aspObj).getParentContainerListID();
  -            addParentContainerList(ctnListID, jesiObj, aspectName, 
contentType, objID);
  -        }
  -        else if (aspObj instanceof JahiaContainerList) {
  -            objID =((JahiaContainerList) aspObj).getID();
  -            /*TODO: should really ignore uninitialized ctnList with ID=0 
since more than one ctnList
  -            (of possibly varying definition names) on a page can have the 
same ctnList ID=0.
  -            In current setup, all fragments referencing ctnList 0 (be it the 
same or of different
  -            definition names) will be invalidated. This isn't really a 
problem because most of fragments
  -            with a ctnList=0 will contain little data.
  -            Possible workarounds: 1/use the ctnList id=0 AND the ctnList's 
definition name as a key so that
  -                                    we don't confound all id=o ctnList on 
the page, and only the right fragment
  -                                    would be invalidated
  -                                  2/rewrite the JahiaContainerSet method so 
that it doesn't create temporary
  -                                    id=0 ctnLists in the jData, but a real 
contianer with a real ID saved in the
  -                                    database. MC and KN looked into it but 
not obvious.
  -                                  3/get addcontainer Engine to fire an event 
which also contains the parent containerList...
  -                                  4/live with current solution.
  -            */
  -            contentType = "JahiaContainerList";
  -            if (objID !=0) {
  -                jesiObj.addContainerList(objID);
  -                if (objID !=0) jesiObj.addAclUserNames(((JahiaContainerList) 
aspObj).getACL());
  -                int ctnID = ((JahiaContainerList) aspObj).getParentEntryID();
  -                addParentContainer(ctnID, jesiObj, aspectName, contentType, 
objID);
  -            }
  -            //we've just detected a ID=0 temporary containerList
  -            else {
  -                String ctnListID0defName = ((JahiaContainerList) 
aspObj).getDefinition().getName();
  -                jesiObj.addContainerListID0(((JahiaContainerList) 
aspObj).getPageID()+"_"+ctnListID0defName);
  +            if (very_verbose) {
  +                //System.err.println(aspectName+"[" + 
this.getClass().getClassLoader().hashCode() + "] ");
  +                //System.err.println(aspectName+" this[" + this + "] ");
  +
  +                MethodRtti mrtti = (MethodRtti) joinPoint.getRtti();
  +                System.err.println(" MethodRtti  
Method:"+mrtti.getMethod().toString());
  +                //    +" Return type:"+mrtti.getReturnType() );
  +                Object[] parameters = mrtti.getParameterValues();
  +                for (int i = 0, j = parameters.length; i < j; i++) {
  +                    System.err.println("                param "+i+" 
Name:"+parameters[i]);
  +                }
               }
  -        }
  -        else if (aspObj instanceof ContainerListBean) {
  -            objID =((ContainerListBean) aspObj).getID();
  -            //ignore ctnList 0
  -            contentType = "ContainerListBean";
  -            if (objID !=0) {
  -                jesiObj.addContainerList(objID);
  -                jesiObj.addAclUserNames(((ContainerListBean) 
aspObj).getACL());
  -                int ctnID = ((ContainerListBean) 
aspObj).getParentContainerID();
  -                addParentContainer(ctnID, jesiObj, aspectName, contentType, 
objID);
  -            }
  -            //we've just detected a ID=0 temporary containerList
  -            else {
  -                String ctnListID0defName = ((ContainerListBean) 
aspObj).getName();
  -                jesiObj.addContainerListID0(((ContainerListBean) 
aspObj).getPageID()+"_"+ctnListID0defName);
  +            String contentType = null;
  +            int objID = -1;
  +
  +            if (aspObj instanceof PageBean) {
  +                objID = ((PageBean) aspObj).getID();
  +                jesiObj.addPage(objID);
  +                jesiObj.addAclUserNames(((PageBean) aspObj).getACL());
  +                contentType = "PageBean";
               }
  -        }
  -        else if (aspObj instanceof ContentContainerList) {
  -            objID =((ContentContainerList) aspObj).getID();
  -            //ignore ctnList 0
  -            contentType = "ContentContainerList";
  -            if (objID !=0) {
  -                jesiObj.addContainerList(objID);
  -                jesiObj.addAclUserNames(((ContentContainerList) 
aspObj).getACL());
  -                int ctnID = ((ContentContainerList) 
aspObj).getParentContainerID();
  -                addParentContainer(ctnID, jesiObj, aspectName, contentType, 
objID);
  -            }
  -            //we've just detected a ID=0 temporary containerList
  -            else {
  -                String ctnListID0defName =
  -                        JahiaContainerDefinitionsRegistry.getInstance 
().getDefinition (
  -                        ((ContentContainerList) 
aspObj).getContainerListDefinitionID()
  -                        ).getName();
  -                jesiObj.addContainerListID0(((ContentContainerList) 
aspObj).getPageID()+"_"+ctnListID0defName);
  +            else if (aspObj instanceof JahiaPage) {
  +                objID = ((JahiaPage) aspObj).getID();
  +                jesiObj.addPage(objID );
  +                jesiObj.addAclUserNames(((JahiaPage) aspObj).getACL());
  +                contentType = "JahiaPage";
               }
  -        }
  -        else  System.err.println("  " + aspectName + ":  Not a recognized 
object type : " + aspObj);
  +            else if (aspObj instanceof ContentPage) {
  +                objID = ((ContentPage) aspObj).getID();
  +                jesiObj.addPage(objID );
  +                jesiObj.addAclUserNames(((ContentPage) aspObj).getACL());
  +                contentType = "ContentPage";
  +            }
  +            else if (aspObj instanceof JahiaField) {
  +                objID = ((JahiaField) aspObj).getID();
  +                jesiObj.addField(objID );
  +                jesiObj.addAclUserNames(((JahiaField) aspObj).getACL());
  +                contentType = "JahiaField";
  +            }
  +            else if (aspObj instanceof FieldBean) {
  +                objID =((FieldBean) aspObj).getID();
  +                jesiObj.addField( objID );
  +                jesiObj.addAclUserNames(((FieldBean) aspObj).getACL());
  +                contentType = "FieldBean";
  +            }
  +            else if (aspObj instanceof ContentField) {
  +                objID =((ContentField) aspObj).getID();
  +                jesiObj.addField( objID );
  +                jesiObj.addAclUserNames(((ContentField) aspObj).getACL());
  +                contentType = "ContentField";
  +            }
  +            else if (aspObj instanceof JahiaContainer) {
  +                objID =((JahiaContainer) aspObj).getID();
  +                jesiObj.addContainer(objID);
  +                jesiObj.addAclUserNames(((JahiaContainer) aspObj).getACL());
  +                contentType = "JahiaContainer";
  +                int ctnListID = ((JahiaContainer) aspObj).getListID();
  +                addParentContainerList(ctnListID, jesiObj, aspectName, 
contentType, objID);
  +            }
  +            else if (aspObj instanceof ContainerBean) {
  +                objID =((ContainerBean) aspObj).getID();
  +                jesiObj.addContainer(objID);
  +                jesiObj.addAclUserNames(((ContainerBean) aspObj).getACL());
  +                contentType = "ContainerBean";
  +                int ctnListID = ((ContainerBean) 
aspObj).getContainerListID();
  +                addParentContainerList(ctnListID, jesiObj, aspectName, 
contentType, objID);
  +            }
  +            else if (aspObj instanceof ContentContainer) {
  +                objID =((ContentContainer) aspObj).getID();
  +                jesiObj.addContainer(objID);
  +                jesiObj.addAclUserNames(((ContentContainer) 
aspObj).getACL());
  +                contentType = "ContentContainer";
  +                int ctnListID = ((ContentContainer) 
aspObj).getParentContainerListID();
  +                addParentContainerList(ctnListID, jesiObj, aspectName, 
contentType, objID);
  +            }
  +            else if (aspObj instanceof JahiaContainerList) {
  +                objID =((JahiaContainerList) aspObj).getID();
  +                /*TODO: should really ignore uninitialized ctnList with ID=0 
since more than one ctnList
  +                (of possibly varying definition names) on a page can have 
the same ctnList ID=0.
  +                In current setup, all fragments referencing ctnList 0 (be it 
the same or of different
  +                definition names) will be invalidated. This isn't really a 
problem because most of fragments
  +                with a ctnList=0 will contain little data.
  +                Possible workarounds: 1/use the ctnList id=0 AND the 
ctnList's definition name as a key so that
  +                                        we don't confound all id=o ctnList 
on the page, and only the right fragment
  +                                        would be invalidated
  +                                      2/rewrite the JahiaContainerSet method 
so that it doesn't create temporary
  +                                        id=0 ctnLists in the jData, but a 
real contianer with a real ID saved in the
  +                                        database. MC and KN looked into it 
but not obvious.
  +                                      3/get addcontainer Engine to fire an 
event which also contains the parent containerList...
  +                                      4/live with current solution.
  +                */
  +                contentType = "JahiaContainerList";
  +                if (objID !=0) {
  +                    jesiObj.addContainerList(objID);
  +                    if (objID !=0) 
jesiObj.addAclUserNames(((JahiaContainerList) aspObj).getACL());
  +                    int ctnID = ((JahiaContainerList) 
aspObj).getParentEntryID();
  +                    addParentContainer(ctnID, jesiObj, aspectName, 
contentType, objID);
  +                }
  +                //we've just detected a ID=0 temporary containerList
  +                else {
  +                    String ctnListID0defName = ((JahiaContainerList) 
aspObj).getDefinition().getName();
  +                    jesiObj.addContainerListID0(((JahiaContainerList) 
aspObj).getPageID()+"_"+ctnListID0defName);
  +                }
  +            }
  +            else if (aspObj instanceof ContainerListBean) {
  +                objID =((ContainerListBean) aspObj).getID();
  +                //ignore ctnList 0
  +                contentType = "ContainerListBean";
  +                if (objID !=0) {
  +                    jesiObj.addContainerList(objID);
  +                    jesiObj.addAclUserNames(((ContainerListBean) 
aspObj).getACL());
  +                    int ctnID = ((ContainerListBean) 
aspObj).getParentContainerID();
  +                    addParentContainer(ctnID, jesiObj, aspectName, 
contentType, objID);
  +                }
  +                //we've just detected a ID=0 temporary containerList
  +                else {
  +                    String ctnListID0defName = ((ContainerListBean) 
aspObj).getName();
  +                    jesiObj.addContainerListID0(((ContainerListBean) 
aspObj).getPageID()+"_"+ctnListID0defName);
  +                }
  +            }
  +            else if (aspObj instanceof ContentContainerList) {
  +                objID =((ContentContainerList) aspObj).getID();
  +                //ignore ctnList 0
  +                contentType = "ContentContainerList";
  +                if (objID !=0) {
  +                    jesiObj.addContainerList(objID);
  +                    jesiObj.addAclUserNames(((ContentContainerList) 
aspObj).getACL());
  +                    int ctnID = ((ContentContainerList) 
aspObj).getParentContainerID();
  +                    addParentContainer(ctnID, jesiObj, aspectName, 
contentType, objID);
  +                }
  +                //we've just detected a ID=0 temporary containerList
  +                else {
  +                    String ctnListID0defName =
  +                            JahiaContainerDefinitionsRegistry.getInstance 
().getDefinition (
  +                                    ((ContentContainerList) 
aspObj).getContainerListDefinitionID()
  +                            ).getName();
  +                    jesiObj.addContainerListID0(((ContentContainerList) 
aspObj).getPageID()+"_"+ctnListID0defName);
  +                }
  +            }
  +            else  System.err.println("  " + aspectName + ":  Not a 
recognized object type : " + aspObj);
   
  -        if (verbose && contentType.indexOf("Bean")!=-1)
  -            System.err.println("           ************************* " + 
aspectName + ":  added " + contentType + " " +
  -                " ID[" +objID + "]" + " to " + jesiObj.getObjDetails());
  -        else if (verbose && contentType.indexOf("Content")!=-1)
  -            System.err.println("           +++++++++++++++++++++++++ " + 
aspectName + ":  added " + contentType + " " +
  -                " ID[" +objID + "]" + " to " + jesiObj.getObjDetails());
  -        else if (verbose )
  -            System.err.println("           " + aspectName + ":  added " + 
contentType + " " +
  -                " ID[" +objID + "]" + " to " + jesiObj.getObjDetails());
  +            if (verbose) {
  +                if (contentType.indexOf("Bean")!=-1)
  +                    System.err.println("           ************************* 
" + aspectName + ":  added " + contentType + " " +
  +                            " ID[" +objID + "]" + " to " + 
jesiObj.getObjDetails());
  +                else if (contentType.indexOf("Content")!=-1)
  +                    System.err.println("           +++++++++++++++++++++++++ 
" + aspectName + ":  added " + contentType + " " +
  +                            " ID[" +objID + "]" + " to " + 
jesiObj.getObjDetails());
  +                else
  +                    System.err.println("           " + aspectName + ":  
added " + contentType + " " +
  +                            " ID[" +objID + "]" + " to " + 
jesiObj.getObjDetails());
  +            }
   
  +        }
  +        catch (Exception ex) {
  +            MemberSignature signature = (MemberSignature) 
joinPoint.getSignature();
  +            System.err.println(" [esi] : ERROR in 
EsiJspContentDetectionAspect - for "
  +                    +aspectName+" aspect: "
  +                    + joinPoint.getCalleeClass().getName() + "::"
  +                    + signature.getName() + "\n" + joinPoint.toString());
  +            System.err.println("-------\n aspObj: "+ aspObj);
  +        }
       }
   
       /**
  @@ -324,12 +343,12 @@
   
           if (parentCtnListID > 0) {  // make sure the parent object is not 
the page, or some temp object with negative ID
               jesiObj.addContainerList(parentCtnListID);
  -                     if (verbose) System.err.println("*           
"+aspectName+":  added PARENT ContainerList ID[" + parentCtnListID + "] for "
  -                             +contentType + " ID[" + ctnID + "]" + " to 
"+jesiObj.getObjDetails());
  +            if (verbose) System.err.println("*           "+aspectName+":  
added PARENT ContainerList ID[" + parentCtnListID + "] for "
  +                    +contentType + " ID[" + ctnID + "]" + " to 
"+jesiObj.getObjDetails());
           } else if (verbose) System.err.println("*           "+aspectName+": 
Could not get Parent ContentContainerList for ContentContainer ID[" + ctnID + 
"]");
       }
   
  -     /**
  +    /**
        *  Add the parent Container (if it exists) of any detected 
ContainerList to the same enclosing ESI object.
        * Since if it changes then the odds are all its contents will also 
(including the ContainerList we are adding)
        * change. Get it?
  @@ -373,7 +392,7 @@
           log("--> " + jp.toString());
           System.err.print("DemoAspect jp.getCaller[" + jp.getCaller() + "] ");
           Object result = jp.proceed(); // will call the next advice or target 
method, field access, constructor etc
  -                MemberSignature signature = 
(MemberSignature)jp.getSignature();
  +        MemberSignature signature = (MemberSignature)jp.getSignature();
           /*System.err.println("ENTER: " + jp.getTargetClass().getName() + 
"::" + signature.getName());
   
                   System.out.println(
  

Reply via email to