RE: does flowscript also support sht like setTimeout and setInterval ?? [SOLVED]

2012-05-24 Thread Robby Pelssers
Ok... I worked around the issue by letting a Java component do all the work. 
This ensures that the flowscript is blocked until all files have been generated.

function generateValuePropositions() {
   var ids = 
Collection.fromArray(getJson('getCommaSeparatedBasicTypeIds')).toList();
   var valuePropositionFactory = cocoon.getComponent('valuePropositionFactory');
   valuePropositionFactory.generateValuePropositions(ids);
   cocoon.sendPage('index.html');
}


Robby

From: Robby Pelssers [mailto:robby.pelss...@nxp.com]
Sent: Thursday, May 24, 2012 4:41 PM
To: dev@cocoon.apache.org
Subject: RE: does flowscript also support sht like setTimeout and setInterval 
?? [SOLVED]

Damn... A woohoo'd a bit too early as I tested with a simplified version.

   setTimeout(
   function() {
   print('Generating value proposition ' + id);  //This works 
just fine as there is no dependency on the environment --> Cocoon object
   }, index * 3000);
   setTimeout(
   function() {
   print('Generating value proposition ' + id);
   cocoon.processPipelineTo("write-map-and-topics/" + id, null, 
new Packages.java.io.ByteArrayOutputStream()); // This runs into an exception 
as the main function returns quickly and my closures can't get hold anymore of 
the current environment
   }, index * 3000);


Caused by: java.lang.IllegalStateException: Unable to locate current 
environment.
at 
org.apache.cocoon.processing.impl.ProcessInfoProviderImpl.getCurrentObjectModel(ProcessInfoProviderImpl.java:44)
at 
org.apache.cocoon.processing.impl.ProcessInfoProviderImpl.getObjectModel(ProcessInfoProviderImpl.java:82)
at 
org.apache.cocoon.components.flow.javascript.fom.FOM_JavaScriptInterpreter.setupView(FOM_JavaScriptInterpreter.java:749)
at 
org.apache.cocoon.components.flow.javascript.fom.FOM_JavaScriptInterpreter.process(FOM_JavaScriptInterpreter.java:742)
at 
org.apache.cocoon.components.flow.javascript.fom.FOM_Cocoon.jsFunction_processPipelineTo(FOM_Cocoon.java:281)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)

Not sure yet if my problem is solvable ;-(

Robby

From: Robby Pelssers [mailto:robby.pelss...@nxp.com]
Sent: Thursday, May 24, 2012 4:04 PM
To: dev@cocoon.apache.org
Subject: RE: does flowscript also support sht like setTimeout and setInterval 
?? [SOLVED]

Works nice !!

function generateValuePropositions() {
   var id_collection = 
Collection.fromArray(getJson('getCommaSeparatedBasicTypeIds'));
   print('Starting generation of ' + id_collection.getLength() + ' value 
propositions!!');
   var index = 0;
   id_collection.forEach(
   /** we write the map and topics for each id **/
   function(id){
   //We delay invocation of the pipeline with 3 seconds
   setTimeout(
   function() {
   print('Generating value proposition ' + id);
   cocoon.processPipelineTo("write-map-and-topics/" + id, null, 
new Packages.java.io.ByteArrayOutputStream());
   }, index * 3000);
   index++;
   }
   );
   cocoon.sendPage('index.html');
}

From: Robby Pelssers [mailto:robby.pelss...@nxp.com]
Sent: Thursday, May 24, 2012 3:58 PM
To: dev@cocoon.apache.org
Subject: RE: does flowscript also support sht like setTimeout and setInterval 
?? [SOLVED]

I found a nice article on stackoverflow showing how to create my own 
implementation in flowscript.  I will of course first need to thoroughly test 
it but it looks promising so far ;-)

var setTimeout,
clearTimeout,
setInterval,
clearInterval;

(function () {
var timer = new java.util.Timer();
var counter = 1;
var ids = {};

setTimeout = function (fn,delay) {
var id = counter++;
ids[id] = new JavaAdapter(java.util.TimerTask,{run: fn});
timer.schedule(ids[id],delay);
return id;
}

clearTimeout = function (id) {
ids[id].cancel();
timer.purge();
delete ids[id];
}

setInterval = function (fn,delay) {
var id = counter++;
ids[id] = new JavaAdapter(java.util.TimerTask,{run: fn});
timer.schedule(ids[id],delay,delay);
return id;
}

clearInterval = clearTimeout;

})();
From: Robby Pelssers [mailto:robby.pelss...@nxp.com]
Sent: Thursday, May 24, 2012 2:56 PM
To: dev@cocoon.apache.org
Subject: does flowscript also support sht like setTimeout and setInterval ??

Hi guys,

I was bulk processing DITA maps and topics from flowscript and noticed that 
following code is executed parallel.  So basically the cocoon.proc

RE: does flowscript also support sht like setTimeout and setInterval ?? [SOLVED]

2012-05-24 Thread Robby Pelssers
Damn... A woohoo'd a bit too early as I tested with a simplified version.
   setTimeout(
   function() {
   print('Generating value proposition ' + id);  //This works 
just fine as there is no dependency on the environment --> Cocoon object
   }, index * 3000);

   setTimeout(
   function() {
   print('Generating value proposition ' + id);
   cocoon.processPipelineTo("write-map-and-topics/" + id, null, 
new Packages.java.io.ByteArrayOutputStream()); // This runs into an exception 
as the main function returns quickly and my closures can't get hold anymore of 
the current environment
   }, index * 3000);


Caused by: java.lang.IllegalStateException: Unable to locate current 
environment.
at 
org.apache.cocoon.processing.impl.ProcessInfoProviderImpl.getCurrentObjectModel(ProcessInfoProviderImpl.java:44)
at 
org.apache.cocoon.processing.impl.ProcessInfoProviderImpl.getObjectModel(ProcessInfoProviderImpl.java:82)
at 
org.apache.cocoon.components.flow.javascript.fom.FOM_JavaScriptInterpreter.setupView(FOM_JavaScriptInterpreter.java:749)
at 
org.apache.cocoon.components.flow.javascript.fom.FOM_JavaScriptInterpreter.process(FOM_JavaScriptInterpreter.java:742)
at 
org.apache.cocoon.components.flow.javascript.fom.FOM_Cocoon.jsFunction_processPipelineTo(FOM_Cocoon.java:281)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)

Not sure yet if my problem is solvable ;-(

Robby

From: Robby Pelssers [mailto:robby.pelss...@nxp.com]
Sent: Thursday, May 24, 2012 4:04 PM
To: dev@cocoon.apache.org
Subject: RE: does flowscript also support sht like setTimeout and setInterval 
?? [SOLVED]

Works nice !!

function generateValuePropositions() {
   var id_collection = 
Collection.fromArray(getJson('getCommaSeparatedBasicTypeIds'));
   print('Starting generation of ' + id_collection.getLength() + ' value 
propositions!!');
   var index = 0;
   id_collection.forEach(
   /** we write the map and topics for each id **/
   function(id){
   //We delay invocation of the pipeline with 3 seconds
   setTimeout(
   function() {
   print('Generating value proposition ' + id);
   cocoon.processPipelineTo("write-map-and-topics/" + id, null, 
new Packages.java.io.ByteArrayOutputStream());
   }, index * 3000);
   index++;
   }
   );
   cocoon.sendPage('index.html');
}

From: Robby Pelssers [mailto:robby.pelss...@nxp.com]
Sent: Thursday, May 24, 2012 3:58 PM
To: dev@cocoon.apache.org
Subject: RE: does flowscript also support sht like setTimeout and setInterval 
?? [SOLVED]

I found a nice article on stackoverflow showing how to create my own 
implementation in flowscript.  I will of course first need to thoroughly test 
it but it looks promising so far ;-)

var setTimeout,
clearTimeout,
setInterval,
clearInterval;

(function () {
var timer = new java.util.Timer();
var counter = 1;
var ids = {};

setTimeout = function (fn,delay) {
var id = counter++;
ids[id] = new JavaAdapter(java.util.TimerTask,{run: fn});
timer.schedule(ids[id],delay);
return id;
}

clearTimeout = function (id) {
ids[id].cancel();
timer.purge();
delete ids[id];
}

setInterval = function (fn,delay) {
var id = counter++;
ids[id] = new JavaAdapter(java.util.TimerTask,{run: fn});
timer.schedule(ids[id],delay,delay);
return id;
}

clearInterval = clearTimeout;

})();
From: Robby Pelssers [mailto:robby.pelss...@nxp.com]
Sent: Thursday, May 24, 2012 2:56 PM
To: dev@cocoon.apache.org
Subject: does flowscript also support sht like setTimeout and setInterval ??

Hi guys,

I was bulk processing DITA maps and topics from flowscript and noticed that 
following code is executed parallel.  So basically the cocoon.processPipelineTo 
returns immediately so it seems.  This results in max sessions reached to XMLDb 
and I run into an exception.  Just checking what is best way to put some delay 
in the execution.

function generateValuePropositions() {
   var id_collection = 
Collection.fromArray(getJson('getCommaSeparatedBasicTypeIds'));
   print('Starting generation of ' + id_collection.getLength() + ' value 
propositions!!');
   id_collection.forEach(
   /** we write the map and topics for each id **/
   function(id){
   cocoon.processPipelineTo("write-map-and-topics/" + id, null, new 
Packages.java.io.ByteArrayOutputStream());
   }
   );
}

Kind regards,
Robby


RE: does flowscript also support sht like setTimeout and setInterval ?? [SOLVED]

2012-05-24 Thread Robby Pelssers
Works nice !!

function generateValuePropositions() {
   var id_collection = 
Collection.fromArray(getJson('getCommaSeparatedBasicTypeIds'));
   print('Starting generation of ' + id_collection.getLength() + ' value 
propositions!!');
   var index = 0;
   id_collection.forEach(
   /** we write the map and topics for each id **/
   function(id){
   //We delay invocation of the pipeline with 3 seconds
   setTimeout(
   function() {
   print('Generating value proposition ' + id);
   cocoon.processPipelineTo("write-map-and-topics/" + id, null, 
new Packages.java.io.ByteArrayOutputStream());
   }, index * 3000);
   index++;
   }
   );
   cocoon.sendPage('index.html');
}

From: Robby Pelssers [mailto:robby.pelss...@nxp.com]
Sent: Thursday, May 24, 2012 3:58 PM
To: dev@cocoon.apache.org
Subject: RE: does flowscript also support sht like setTimeout and setInterval 
?? [SOLVED]

I found a nice article on stackoverflow showing how to create my own 
implementation in flowscript.  I will of course first need to thoroughly test 
it but it looks promising so far ;-)

var setTimeout,
clearTimeout,
setInterval,
clearInterval;

(function () {
var timer = new java.util.Timer();
var counter = 1;
var ids = {};

setTimeout = function (fn,delay) {
var id = counter++;
ids[id] = new JavaAdapter(java.util.TimerTask,{run: fn});
timer.schedule(ids[id],delay);
return id;
}

clearTimeout = function (id) {
ids[id].cancel();
timer.purge();
delete ids[id];
}

setInterval = function (fn,delay) {
var id = counter++;
ids[id] = new JavaAdapter(java.util.TimerTask,{run: fn});
timer.schedule(ids[id],delay,delay);
return id;
}

clearInterval = clearTimeout;

})();
From: Robby Pelssers [mailto:robby.pelss...@nxp.com]
Sent: Thursday, May 24, 2012 2:56 PM
To: dev@cocoon.apache.org
Subject: does flowscript also support sht like setTimeout and setInterval ??

Hi guys,

I was bulk processing DITA maps and topics from flowscript and noticed that 
following code is executed parallel.  So basically the cocoon.processPipelineTo 
returns immediately so it seems.  This results in max sessions reached to XMLDb 
and I run into an exception.  Just checking what is best way to put some delay 
in the execution.

function generateValuePropositions() {
   var id_collection = 
Collection.fromArray(getJson('getCommaSeparatedBasicTypeIds'));
   print('Starting generation of ' + id_collection.getLength() + ' value 
propositions!!');
   id_collection.forEach(
   /** we write the map and topics for each id **/
   function(id){
   cocoon.processPipelineTo("write-map-and-topics/" + id, null, new 
Packages.java.io.ByteArrayOutputStream());
   }
   );
}

Kind regards,
Robby


RE: does flowscript also support sht like setTimeout and setInterval ?? [SOLVED]

2012-05-24 Thread Robby Pelssers
I found a nice article on stackoverflow showing how to create my own 
implementation in flowscript.  I will of course first need to thoroughly test 
it but it looks promising so far ;-)

var setTimeout,
clearTimeout,
setInterval,
clearInterval;

(function () {
var timer = new java.util.Timer();
var counter = 1;
var ids = {};

setTimeout = function (fn,delay) {
var id = counter++;
ids[id] = new JavaAdapter(java.util.TimerTask,{run: fn});
timer.schedule(ids[id],delay);
return id;
}

clearTimeout = function (id) {
ids[id].cancel();
timer.purge();
delete ids[id];
}

setInterval = function (fn,delay) {
var id = counter++;
ids[id] = new JavaAdapter(java.util.TimerTask,{run: fn});
timer.schedule(ids[id],delay,delay);
return id;
}

clearInterval = clearTimeout;

})();
From: Robby Pelssers [mailto:robby.pelss...@nxp.com]
Sent: Thursday, May 24, 2012 2:56 PM
To: dev@cocoon.apache.org
Subject: does flowscript also support sht like setTimeout and setInterval ??

Hi guys,

I was bulk processing DITA maps and topics from flowscript and noticed that 
following code is executed parallel.  So basically the cocoon.processPipelineTo 
returns immediately so it seems.  This results in max sessions reached to XMLDb 
and I run into an exception.  Just checking what is best way to put some delay 
in the execution.

function generateValuePropositions() {
   var id_collection = 
Collection.fromArray(getJson('getCommaSeparatedBasicTypeIds'));
   print('Starting generation of ' + id_collection.getLength() + ' value 
propositions!!');
   id_collection.forEach(
   /** we write the map and topics for each id **/
   function(id){
   cocoon.processPipelineTo("write-map-and-topics/" + id, null, new 
Packages.java.io.ByteArrayOutputStream());
   }
   );
}

Kind regards,
Robby


does flowscript also support sht like setTimeout and setInterval ??

2012-05-24 Thread Robby Pelssers
Hi guys,

I was bulk processing DITA maps and topics from flowscript and noticed that 
following code is executed parallel.  So basically the cocoon.processPipelineTo 
returns immediately so it seems.  This results in max sessions reached to XMLDb 
and I run into an exception.  Just checking what is best way to put some delay 
in the execution.

function generateValuePropositions() {
   var id_collection = 
Collection.fromArray(getJson('getCommaSeparatedBasicTypeIds'));
   print('Starting generation of ' + id_collection.getLength() + ' value 
propositions!!');
   id_collection.forEach(
   /** we write the map and topics for each id **/
   function(id){
   cocoon.processPipelineTo("write-map-and-topics/" + id, null, new 
Packages.java.io.ByteArrayOutputStream());
   }
   );
}

Kind regards,
Robby


Re: [jira] [Commented] (COCOON3-101) Keep archetype synced

2012-05-24 Thread Thorsten Scherler

On 05/24/2012 09:29 AM, Hudson (JIRA) wrote:

 [ 
https://issues.apache.org/jira/browse/COCOON3-101?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13282254#comment-13282254
 ]

Hudson commented on COCOON3-101:


Integrated in Cocoon-trunk #180 (See 
[https://builds.apache.org/job/Cocoon-trunk/180/])
 [COCOON3-101] Fixing license headers (causing rat to make the build fail) 
(Revision 1342155)

  Result = SUCCESS
ilgrosso : http://svn.apache.org/viewvc/?view=rev&rev=1342155
Files :
* /cocoon/cocoon3/trunk/cocoon-archetype-block/xsl/properties-to-pom.xsl



DOH!

Thanks very much.

salu2

--
Thorsten Scherler
codeBusters S.L. - web based systems

http://www.codebusters.es/



[jira] [Commented] (COCOON3-101) Keep archetype synced

2012-05-24 Thread Hudson (JIRA)

[ 
https://issues.apache.org/jira/browse/COCOON3-101?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13282254#comment-13282254
 ] 

Hudson commented on COCOON3-101:


Integrated in Cocoon-trunk #180 (See 
[https://builds.apache.org/job/Cocoon-trunk/180/])
[COCOON3-101] Fixing license headers (causing rat to make the build fail) 
(Revision 1342155)

 Result = SUCCESS
ilgrosso : http://svn.apache.org/viewvc/?view=rev&rev=1342155
Files : 
* /cocoon/cocoon3/trunk/cocoon-archetype-block/xsl/properties-to-pom.xsl


> Keep archetype synced
> -
>
> Key: COCOON3-101
> URL: https://issues.apache.org/jira/browse/COCOON3-101
> Project: Cocoon 3
>  Issue Type: New Feature
>  Components: cocoon-archetype-X
>Reporter: Thorsten Scherler
>
> http://cocoon.markmail.org/thread/f6hruvbn7h7orllp

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira