<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML xmlns="http://www.w3.org/TR/REC-html40" xmlns:v =
"urn:schemas-microsoft-com:vml" xmlns:o =
"urn:schemas-microsoft-com:office:office" xmlns:w =
"urn:schemas-microsoft-com:office:word" xmlns:m =
"http://schemas.microsoft.com/office/2004/12/omml"><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.6000.16890" name=GENERATOR>
<STYLE>@font-face {
font-family: Cambria Math;
}
@font-face {
font-family: Calibri;
}
@page Section1 {size: 8.5in 11.0in; margin: 1.0in 1.0in 1.0in 1.0in; }
P.MsoNormal {
FONT-SIZE: 11pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Calibri","sans-serif"
}
LI.MsoNormal {
FONT-SIZE: 11pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Calibri","sans-serif"
}
DIV.MsoNormal {
FONT-SIZE: 11pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Calibri","sans-serif"
}
A:link {
COLOR: blue; TEXT-DECORATION: underline; mso-style-priority: 99
}
SPAN.MsoHyperlink {
COLOR: blue; TEXT-DECORATION: underline; mso-style-priority: 99
}
A:visited {
COLOR: purple; TEXT-DECORATION: underline; mso-style-priority: 99
}
SPAN.MsoHyperlinkFollowed {
COLOR: purple; TEXT-DECORATION: underline; mso-style-priority: 99
}
SPAN.EmailStyle17 {
COLOR: windowtext; FONT-FAMILY: "Calibri","sans-serif"; mso-style-type: personal-compose
}
.MsoChpDefault {
mso-style-type: export-only
}
DIV.Section1 {
page: Section1
}
</STYLE>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></HEAD>
<BODY lang=EN-US vLink=purple link=blue>
<DIV dir=ltr align=left><SPAN class=326184411-04092009><FONT face=Arial
color=#0000ff size=2>Hi Jasper</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=326184411-04092009><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=326184411-04092009><FONT face=Arial
color=#0000ff size=2>I've just finished some event listener code that
publishes a custom-made list of resources. After checking some other approaches,
I actually ended up with more or less the exact same code you posted here.
My resources get published.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=326184411-04092009><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=326184411-04092009><FONT face=Arial
color=#0000ff size=2>Looks like something's happening in your getPublishList
call - from your screenshot it looks like the method returns an
empty list?</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=326184411-04092009><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=326184411-04092009><FONT face=Arial
color=#0000ff size=2>From what little I know, this could happen because of
either:</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=326184411-04092009><FONT face=Arial
color=#0000ff size=2>1.) the user trying to perform the publish operation
on the resource(s) does not have publish permissions, or </FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=326184411-04092009><FONT face=Arial
color=#0000ff size=2>2.) the resource(s) are not lockable by the user trying to
perform the publish operation.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=326184411-04092009><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=326184411-04092009><FONT face=Arial
color=#0000ff size=2>There may be other possible reasons (of which I'm
unaware), but I'd check these two at least: make sure your resources
are lockable, and perform the publish operation using an Admin
account.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=326184411-04092009><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=326184411-04092009><FONT face=Arial
color=#0000ff size=2>HTH</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=326184411-04092009><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=326184411-04092009><FONT face=Arial
color=#0000ff size=2>Cheers,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=326184411-04092009><FONT face=Arial
color=#0000ff size=2>Paul</FONT></SPAN></DIV><BR>
<BLOCKQUOTE dir=ltr
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> opencms-dev-bounces@opencms.org
[mailto:opencms-dev-bounces@opencms.org] <B>On Behalf Of </B>Jasper
Roel<BR><B>Sent:</B> 1. september 2009 20:03<BR><B>To:</B>
opencms-dev@opencms.org<BR><B>Subject:</B> [opencms-dev] Problem publishing a
specific list of resources<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV class=Section1>
<P class=MsoNormal>I’ve been trying to get OpenCms to publish only a specific
subset of resources in OpenCms. This is a mix of new folders, new files,
modified resources and deleted resources.<o:p></o:p></P>
<P class=MsoNormal><o:p> </o:p></P>
<P class=MsoNormal>This code is run via the Administration panel through a
newly created Module.<o:p></o:p></P>
<P class=MsoNormal><o:p> </o:p></P>
<P class=MsoNormal>The code extract looks something like this;<o:p></o:p></P>
<P class=MsoNormal><o:p> </o:p></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'"> </SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: #3f7f5f; FONT-FAMILY: 'Courier New'">// This
list gets populated before creating the CmsPublishList</SPAN><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'"> List<CmsResource>
resourcesToPublish = new ArrayList<CmsResource>();<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'"><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; COLOR: #3f7f5f; FONT-FAMILY: 'Courier New'">// Only
publish what we actually touched</SPAN><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><o:p></o:p></SPAN></P>
<P class=MsoNormal><B><SPAN
style="FONT-SIZE: 10pt; COLOR: #7f0055; FONT-FAMILY: 'Courier New'">boolean</SPAN></B><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">
publishSiblings = </SPAN><B><SPAN
style="FONT-SIZE: 10pt; COLOR: #7f0055; FONT-FAMILY: 'Courier New'">false</SPAN></B><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">;</SPAN><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><o:p></o:p></SPAN></P>
<P class=MsoNormal><B><SPAN
style="FONT-SIZE: 10pt; COLOR: #7f0055; FONT-FAMILY: 'Courier New'">boolean</SPAN></B><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">
publishSubResources = </SPAN><B><SPAN
style="FONT-SIZE: 10pt; COLOR: #7f0055; FONT-FAMILY: 'Courier New'">false</SPAN></B><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">;</SPAN><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'"> <o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">CmsPublishList
publishList = OpenCms.<I>getPublishManager</I>().getPublishList(</SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: #0000c0; FONT-FAMILY: 'Courier New'">cms</SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">, <SPAN
style="BACKGROUND: silver; mso-highlight: silver">resourcesToPublish</SPAN>,
publishSiblings,</SPAN><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> <SPAN
style="COLOR: black">publishSubResources);</SPAN><o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'"><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">OpenCms.<I>getPublishManager</I>().publishProject(</SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: #0000c0; FONT-FAMILY: 'Courier New'">cms</SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">,
</SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: #0000c0; FONT-FAMILY: 'Courier New'">report</SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">,
publishList);</SPAN><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">OpenCms.<I>getPublishManager</I>().waitWhileRunning();</SPAN><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><o:p></o:p></SPAN></P>
<P class=MsoNormal><o:p> </o:p></P>
<P class=MsoNormal>A short example of the result of this code is attached. All
the resources with status N & U (New and Updated) are added to the
resourcesToPublish List, but the publishProject publishes none of them (see
ImportLog.htm for the result).<o:p></o:p></P>
<P class=MsoNormal><o:p> </o:p></P>
<P class=MsoNormal>Any idea why OpenCms decides not to publish my resources,
or is there a better way to publish these specific resources
programmaticly?<o:p></o:p></P>
<P class=MsoNormal><o:p> </o:p></P>
<P class=MsoNormal>Thanks,<o:p></o:p></P>
<P class=MsoNormal><o:p> </o:p></P>
<P class=MsoNormal>Jasper Roel<o:p></o:p></P></DIV></BLOCKQUOTE></BODY></HTML>