[opencms-dev] RE: vfslink confusion

aaron butler abutler at trstone.com
Thu Feb 19 16:01:00 CET 2004


OK, I've looked at the other side of these links and I'm even more mixed up.

  It looks like CMS_ResourceBroker.joinLinksToTargets (v5.0.1) 
uses  CMSDbAccess.updateResourceFlags in 2 different ways: in the commented 
section 5
// 5) update the VFS link count per target resource
it stores the count of unique pointers to a resource in the ResourceFlags 
column:
m_dbAccess.updateResourceFlags(theProject, targetIDs[i], linksPerTarget[i]);

then in section 6
// 6) update the target resource ID's in each VFS link
it keeps the current targetID for a given link
m_dbAccess.updateResourceFlags(theProject, linkID, targetID);

For me to track this information, will I need to create a link resource for 
each graphic in my galleries, and use those links instead of the graphics 
in the sourcecode editor?  That seems very wrong, since the work of 
generating the internal link references is done in 
com.opencms.util.LinkSubstitution, and the core engine is clearly able to 
find the resource from the publication direction.

My inclination is to find out when the editor saves its changes, and make 
sure it is automatically creating a new link resource for each new anchor, 
graphic, or other resource included.

Am I going about this the right way?  It still seems more likely that I am 
completely missing the point of something.


-Aaron



>Date: Wed, 18 Feb 2004 13:50:33 -0500
>To: opencms-dev at opencms.org
>From: aaron butler <abutler at trstone.com>
>Subject: vfslink confusion
>
>I am trying to track which pages use particular graphics.  I thought that 
>would be done using the "Show Filesystem Links" option in the offline file 
>dropdown list, but that doesn't seem to work.  If I understand the code 
>correctly, there is no way for it to work in version 5.0.1 - the 
>query.properties file in com.opencms.file.genericSql is
>
>C_SELECT_VFS_LINKS=SELECT CMS_RESOURCES.RESOURCE_NAME \
>         FROM CMS_RESOURCES \
>         WHERE CMS_RESOURCES.RESOURCE_FLAGS = ? \
>         AND CMS_RESOURCES.RESOURCE_TYPE = ? \
>         AND CMS_RESOURCES.STATE != ? \
>         ORDER BY CMS_RESOURCES.RESOURCE_NAME ASC
>
>The stacktrace goes like
>CmsNewExplorerFileList.getContent ->  CmsNewExplorerFileList.getRessources 
>->  CMSObject.fetchVfsLinksForResource 
>->  CMSResourceBroker.fetchVfsLinksForResource 
>->  DBAccess.fetchVfsLinksForResourceID
>  where DBAccess.fetchVfsLinksForResourceID has the following code:
>---------
>String query = "C_SELECT_VFS_LINKS";
>         String pool = m_poolName;
>         PreparedStatement stmnt = null;
>         Connection con = null;
>         ResultSet result = null;
>         ArrayList vfsLinks = new ArrayList();
>
>         // check if we need to use the same query working on the tables 
> of the online project
>         if (theProject.getId() == I_CmsConstants.C_PROJECT_ONLINE_ID) {
>             pool = m_poolNameOnline;
>             query += "_ONLINE";
>         }
>
>         try {
>             // execute the query
>             con = DriverManager.getConnection(pool);
>             stmnt = con.prepareStatement(m_cq.get(query));
>             stmnt.setInt(1, theResourceID);
>             stmnt.setInt(2, theResourceTypeLinkID);
>             stmnt.setInt(3, C_STATE_DELETED);
>             result = stmnt.executeQuery()
>----------
>which means theResourceID is getting put into the slot marked for 
>Resource_Flags.
>Changing the reference in the query.properties file to ResourceID didn't 
>solve the problem, though.
>
>Should CMSResourceBroker be calling
>CMSDbAccess.fetchAllVfsLinks(CmsProject theProject, ArrayList 
>theResourceIDs, ArrayList theLinkContents, ArrayList theLinkResources, int 
>theResourceTypeLinkID)
>instead?
>
>Am I completely misunderstanding the point of Show Filesystem Links?  I 
>built 5.3.3 from CVS source (anon/anon, whatever branch/tag that will give 
>me) and that doesn't seem to mesh with my understanding either.  I can 
>forcefully change the LinkCount for a given resource and thereby get the 
>Show Filesystem Links to be selectable in the dropdown list (or type in 
>vfslink:/path/to/file) but I don't know what to do to make it show all the 
>places I use a particular graphic.  I haven't dug in much on the 5.3.3 
>source, though, and link management seems a bit buggy in other ways; maybe 
>this is the right code base, but it needs the rest of the inclusion of 
><img src= "">, <link /> or <cms:link /> to be handled correctly for this 
>feature to work...
>
>Can someone point me in the right direction for this?  It would be great 
>if I could work with 5.0.1, since I'm on a short timeframe, but that may 
>not be possible.
>
>
>-Aaron
>





More information about the opencms-dev mailing list