PDA

View Full Version : pentaho.xml



spmva
05-24-2006, 08:09 AM
I noticed that the system-actions section of the pentaho.xml file allows you to place IPentahoResultSet instances in a global or session cache. I guess that the actions get executed at start-up and the output get placed in the appropriate cache. Saw that code in the PentahoSystem class.

I'm interested in placing something in the global cache...but I don't need the complexity of IPentahoResultSet. I just want to put a string value in the cache. Is that possible?

Hope I have missed the answer to this somewhere else.

Thanks,

Steve

mbatchelor
05-24-2006, 08:35 AM
Sure - instead of it being a PentahoResultSet, it could be a string. No problem.

spmva
05-24-2006, 08:51 AM
I think I need a little bit more clarification. In PentahoSystem, the place where I perceive the global cache to be initialized, I see this code:


while (outputIterator.hasNext()) {
IActionParameter output = context.getOutputParameter((String) outputIterator.next());
String attributeName = output.getName();
IPentahoResultSet data = output.getValueAsResultSet();
if (data != null) {
if ("session".equals(scope)) { //$NON-NLS-1$
session.removeAttribute(attributeName); //$NON-NLS-1$
session.setAttribute(attributeName, data);
} else if ("global".equals(scope)) { //$NON-NLS-1$
globalAttributes.remove(attributeName); //$NON-NLS-1$
globalAttributes.put(attributeName, data);
}

}
}


Unless there is some other place where these values are initialized, this line:


IPentahoResultSet data = output.getValueAsResultSet();

forces the value to be a IPentahoResultSet. What am I missing?

Also, can that string value I want to put on the global cache be initialized without having to be established through system-actions? That objects section looks like a good spot...

Thanks,

Steve

mbatchelor
05-24-2006, 09:05 AM
First, let me say that I should have read more closely before answering immediately. You were clear that you were looking at the system actions section, and I completely glazed over that part. My apologies.

Second, I think that the current implementation is a bug (that I'll create a case on). You should be able to have whatever output type you desire stored in the session or global map from within an action sequence.

However, I think I need to understand something first - what are you trying to do. If I understand what you're looking to do, I think it will help. For what purpose are you trying to store something in the global map?

Marc

spmva
05-24-2006, 10:23 AM
Perhaps, I should have tried to explain where I was going with this...I just didn't want too much info clouding my question.

I'm looking for a way to have access to system wide configuration constants.

A trivial example...I have some .NET web services that I'd like to connect to from a Javascript component. I would want to keep the URL for the service separate from the code, since the URL changes from my development environment to test to production. If I were able to store that value in the global cache (or some other place that's better in your opinion) I could make that change in one place outside of my code.

Thanks for creating a case...wow...I'm less than 10 posts in and I've already contributed something positive to the project! Is there a public case tracking system? I don't see a link to one immediately.

Steve

mbatchelor
05-24-2006, 12:07 PM
That should be coming within 60-90 days.

spmva
05-24-2006, 12:18 PM
I assume that you mean 60-90 days for the public case tracker...not for the bug fix, correct?

In the meantime, unless you have some other suggestion, I'll just try to get as much of my config type stuff into a javascript file and reference it as a library when I need those configuration options. Though a cleaner option would be appreciated if anyone has ideas.

Best regards,

Steve

mbatchelor
05-24-2006, 12:45 PM
Sorry, yes. 60-90 days for public access to bug tracking and such.

As for the solution, you could go with a javascript rule as you suggest.

One of the engineers here suggested creating a Servlet Filter that pumps your values into the HttpSession (perhaps by reading a file from the solution). It would be simple to do, and you'd only need that in there until the bug got fixed. But, once the bug was fixed, you could remove the filter from the chain and not have to modify your action sequences (as long as you were ok with them being in the session instead of in the globals).

Alternately, you could have a go at changing the PentahoSystem as follows:

From:

IPentahoResultSet data = output.getValueAsResultSet();

To:

Object data = output.getValue();


Take care,

Marc

spmva
06-30-2006, 03:42 AM
I noticed that 1.1.7 includes the change from IPentahoResultSet to


Object data = output.getValue();

It looks exactly the same as the change I made when Marc suggested it earlier in this thread. Unfortunately, the change I made did not work and I thought that there might have been more changes somewhere else in the code set to allow the assignment of non-IPentahoResultSet values.

Now that the change is official, I'm still having problems getting string output parameters assigned to global. My problem could be related to my understanding of what "global" means and how it relates to pentaho.xml.

Intuitively, I would guess that on start-up of the pentaho server, the pentaho.xml file is read. There are a number of configurations and initializations made. One of those configuration/initializations is the execution of the elements in the system-actions tag.

So an entry like:


<org.pentaho.session.PentahoHttpSession scope="global">mip-default/test/test-init-globals.xaction</org.pentaho.session.PentahoHttpSession>


would get executed. (1) Do all the named outputs in this .xaction get pushed into globals or only those that have a <destinations> of <global>? In my opinion, it would make sense if all outputs were pushed to global. The results of any .xaction could then become globally available by simply adding an entry to pentaho.xml, without modification for explicit "global" assignment within the .xaction, leaving it reusable for other functionality.

The samples that use global values are all related to the usage of Secure Filters and are marked as "Portal Only". (2) The fact that it reads "Portal Only" doesn't mean that globals are "Portal Only", it means that "Secure Filters" require the portal...correct?

At this point, my simple example is complaining that:


Error: RuntimeContext.ERROR_0018 - The requested parameter "GLOBAL_TEST_1" has a NULL value (org.pentaho.core.runtime.RuntimeContext)

Running the .xaction that puts the values in global seems to work without a problem so it doesn't seem to be an execution problem on that side.

I've attached my files. Can someone please take a look? I wouldn't be surprised if this were a configuration problem on my end. Also some insight on the two questions I posed above would help my understanding.

Best regards,

Steve http://forums.pentaho.org/archived_att/files/TestGlobals1.zip

vgarcia
10-02-2006, 11:49 PM
I have the same problems with the version 1.2RC1.. Are resolved this problem actually?

mbatchelor
10-05-2006, 09:30 AM
This was fixed and checked into our SVN repository. You should see that this is changed in RC3.