Re: CF and Java

2009-08-10 Thread Larry Lyons

>Larry,
>Excellent Resource. Thanx for sharing.
>

Glad to help. Also if you're going to CFUnited, Adam Haskell is giving a 2 part 
presentation on CF and java. he already has his code available online: 
http://cfrant.blogspot.com/2009/08/cfunited-introduction-to-java.html

regards,
larry 

~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:325321
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: CF and Java

2009-08-10 Thread Gerald Guido

Larry,
Excellent Resource. Thanx for sharing.

G!

On Mon, Aug 10, 2009 at 12:20 PM, Larry Lyons  wrote:

>
> Alan,
>
> A couple of things, first off Elliot Spren had a great presentation last
> year on the java internals of CF. Its available online:
> http://tinyurl.com/cf-internals-presentation
>
> Also cfdump can be very helpful in exploring the built in java classes.
> Simply create the java object then use cfdump to get the methods. Also
> remember that all of the standard java packages are available to CF.
>
> hth,
> larry
>
> 

~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:325320
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: CF and Java

2009-08-10 Thread Larry Lyons

>Hey All,
>Has anyone found an easy way to "wander" through all of the classes /
>packages available to CF through Java?
>
>I keep finding cool things other people have done using Java classes or
>packages that CF has already built in, but aren't in any way documented.
>
>I'd just like to wander through like I do in the Flex API docs and look for
>interestingly named items and figure out what they do...
>

Alan,

A couple of things, first off Elliot Spren had a great presentation last year 
on the java internals of CF. Its available online: 
http://tinyurl.com/cf-internals-presentation

Also cfdump can be very helpful in exploring the built in java classes. Simply 
create the java object then use cfdump to get the methods. Also remember that 
all of the standard java packages are available to CF.

hth,
larry 

~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:325317
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: CF and Java

2009-08-07 Thread Dave l

you could always hit it with cfdirectory and look at dateLastModified



> > However, it may still be possible that there are other
> > classes and packages
> > out the in CF that CAN pull assets from SWF files... Seems
> > unlikely, but who
> > knows, there are sooo many of them.
> 
> 
> I have never used it. But if you are curious, open the jar and look 
> inside ;-) That class is from the 
> C:\ColdFusion8\wwwroot\WEB-INF\cfform\jars\flex.jar
> 
> -Leigh
> 
> 
  
> 


~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:325294
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: CF and Java

2009-08-07 Thread Leigh

> However, it may still be possible that there are other
> classes and packages
> out the in CF that CAN pull assets from SWF files... Seems
> unlikely, but who
> knows, there are sooo many of them.


I have never used it. But if you are curious, open the jar and look inside ;-) 
That class is from the C:\ColdFusion8\wwwroot\WEB-INF\cfform\jars\flex.jar

-Leigh


  


~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:325282
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: CF and Java

2009-08-07 Thread Alan Rother

As far as I have been able to determine all it does is to return the meta
info for the file.
http://coldfused.blogspot.com/2008/02/reading-flash-swf-metadata-from.html

Is
Compressed : #header.compressed#
Frame Count : #header.framecount#
Frame rate : #header.rate#
Version : #header.version#
Height : #rect.getHeight()#
Width : #rect.getWidth()#");

I used the code from Rupesh to build a function that should be available on
CFLIB.org soon. Ray just needs to approve it.

However, it may still be possible that there are other classes and packages
out the in CF that CAN pull assets from SWF files... Seems unlikely, but who
knows, there are sooo many of them.

=]

-- 
Alan Rother
Adobe Certified Advanced ColdFusion MX 7 Developer
Manager, Phoenix Cold Fusion User Group, AZCFUG.org


~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:325279
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: CF and Java

2009-08-07 Thread Mark Kruger

Alan,

Getting in on this late (sorry). This tag decoder allows you to do what -
get at the dimensions of the stage in the swf file?  Pretty cool. Does it
allow for anything else? Like extracting the embedded assets etc?

-Mark
 


Mark A. Kruger, CFG, MCSE
(402) 408-3733 ext 105
www.cfwebtools.com
www.coldfusionmuse.com
www.necfug.com

-Original Message-
From: Alan Rother [mailto:alan.rot...@gmail.com] 
Sent: Friday, August 07, 2009 11:04 AM
To: cf-talk
Subject: Re: CF and Java


Cool,
thanks everyone.

Just in case someone else has something, let me give a better example of
what I'm talking about.

I had a problem the other day where I had a client who has a website with
years and years of assets stacking up on their server. They had hundreds of
SWF files in one folder and a database table linking them to the respective
advertisers. Unfortunately due to bad design by the original author, there
were no dates associated with the files in the database (UUID PK).

The one thing the client did know was that they only wanted to be using
their newest size of 138h X 250w. So any files that were not that dimension
could be filtered out. SO I needed a way to programatically determine their
sizes.

One quick google search turned up the perfect solution on Rupesh Kumar's
blog, which is what started all of this for me. Now Rupesh is one of the
engineers at Adobe, so he has all sorts of inside info, but how would any of
us regular programmers know that this package existed

decoder = createObject("java", "macromedia.swf.TagDecoder").init(fis); //
create TagDecoder

And how many other amazing little tidbits like this are there still waiting
to be found and put to use...
Anyhow... Thats was my inspiration for wanting to troll through all the java
packages CF has just laying around.

=]

--
Alan Rother
Adobe Certified Advanced ColdFusion MX 7 Developer Manager, Phoenix Cold
Fusion User Group, AZCFUG.org




~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:325275
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: CF and Java

2009-08-07 Thread Alan Rother

Cool,
thanks everyone.

Just in case someone else has something, let me give a better example of
what I'm talking about.

I had a problem the other day where I had a client who has a website with
years and years of assets stacking up on their server. They had hundreds of
SWF files in one folder and a database table linking them to the
respective advertisers. Unfortunately due to bad design by the original
author, there were no dates associated with the files in the database (UUID
PK).

The one thing the client did know was that they only wanted to be using
their newest size of 138h X 250w. So any files that were not that dimension
could be filtered out. SO I needed a way to programatically determine their
sizes.

One quick google search turned up the perfect solution on Rupesh Kumar's
blog, which is what started all of this for me. Now Rupesh is one of the
engineers at Adobe, so he has all sorts of inside info, but how would any of
us regular programmers know that this package existed

decoder = createObject("java", "macromedia.swf.TagDecoder").init(fis); //
create TagDecoder

And how many other amazing little tidbits like this are there still waiting
to be found and put to use...
Anyhow... Thats was my inspiration for wanting to troll through all the java
packages CF has just laying around.

=]

-- 
Alan Rother
Adobe Certified Advanced ColdFusion MX 7 Developer
Manager, Phoenix Cold Fusion User Group, AZCFUG.org


~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:325273
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: CF and Java

2009-08-07 Thread Eric Cobb

I'm not sure if all of these are available to CF.

http://java.sun.com/javase/6/docs/api/overview-summary.html


Thanks,

Eric Cobb
http://www.cfgears.com


Alan Rother wrote:
> Hey All,
> Has anyone found an easy way to "wander" through all of the classes /
> packages available to CF through Java?
> 
> I keep finding cool things other people have done using Java classes or
> packages that CF has already built in, but aren't in any way documented.
> 
> I'd just like to wander through like I do in the Flex API docs and look for
> interestingly named items and figure out what they do...
> 
> =]
> 


~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:325262
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: CF and Java

2009-08-07 Thread Dominic Watson

I don't know that there is any tidy browser type thing - but Alagad built a
little tool for reflection:

http://www.alagad.com/reflection/
( http://www.alagad.com/go/products-and-projects )

Perhaps combine that with this:

http://fusion.dominicwatson.co.uk/2007/09/coldfusion-objects-are-java-objects.html

And maybe you could build your own full coldfusion object javadoc navigator
thing (unless someone can find one that exists already) ;)

Dominic

2009/8/7 Alan Rother 

>
> Hey All,
> Has anyone found an easy way to "wander" through all of the classes /
> packages available to CF through Java?
>
> I keep finding cool things other people have done using Java classes or
> packages that CF has already built in, but aren't in any way documented.
>
> I'd just like to wander through like I do in the Flex API docs and look for
> interestingly named items and figure out what they do...
>
> =]
>
> --
> Alan Rother
> Adobe Certified Advanced ColdFusion MX 7 Developer
> Manager, Phoenix Cold Fusion User Group, AZCFUG.org
>


~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:325261
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: CF and Java

2009-08-06 Thread Gerald Guido

 *** *Here is a place to start:

http://java.sun.com/javase/reference/api.jsp

Not exactly what you are looking for but... Ike Dealey did a lot of CF
related Java spelunking in this article

http://coldfusion.sys-con.com/node/45569

I found it to be a good read and it turned me on to a lot of new ideas.

HTH

G!

On Thu, Aug 6, 2009 at 8:03 PM, Alan Rother  wrote:

>
> Hey All,
> Has anyone found an easy way to "wander" through all of the classes /
> packages available to CF through Java?
>
> I keep finding cool things other people have done using Java classes or
> packages that CF has already built in, but aren't in any way documented.
>
> I'd just like to wander through like I do in the Flex API docs and look for
> interestingly named items and figure out what they do...
>
> =]
>
> --
> Alan Rother
> Adobe Certified Advanced ColdFusion MX 7 Developer
> Manager, Phoenix Cold Fusion User Group, AZCFUG.org
>
>
> 

~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:325257
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: CF and Java

2007-04-19 Thread Andrew Whone
Line 91 is:
XMLSignatureInput result = transforms.performTransforms(input);
10 from the end.
A+

~|
Upgrade to Adobe ColdFusion MX7
Experience Flex 2 & MX7 integration & create powerful cross-platform RIAs
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJQ 

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:275881
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: CF and Java

2007-04-18 Thread Phillip Duba
What is line 91 in your java file? That's where the error in your class
is being thrown,

Phil

-Original Message-
From: Russ [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, April 18, 2007 11:46 AM
To: CF-Talk
Subject: RE: CF and Java

Looks like something is getting a null pointer, meaning something is not
getting set.  I usually find it easier to create the methods, test them
in
java through eclipse (stepping through the debugger if necessary) and
once
it's ready to put it to cf.  Basically it's breaking at line 91 in your
file, so either your passing some null variable, or you forgot to set
something, etc.. 

Russ

> -Original Message-
> From: Andrew Whone [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, April 18, 2007 11:01 AM
> To: CF-Talk
> Subject: Re: CF and Java
> 
> I got a bit further on using Mark Mandels Javaloader.
> The coldfusion code is:
> 
> loadPaths = ArrayNew(1);
> loadPaths[1] = expandPath("irmarkjars");
> loadPaths[2] = expandPath("irmarkjars\jce-jdk13-114.jar");
> loadPaths[3] = expandPath("irmarkjars\style-apachexml.jar");
> loadPaths[4] = expandPath("irmarkjars\stylebook-1.0-b3_xalan-2.jar");
> loadPaths[5] = expandPath("irmarkjars\xmlParserAPIs.jar");
> loadPaths[6] = expandPath("irmarkjars\xmlsec.jar");
> loadPaths[7] = expandPath("irmarkjars\jakarta-log4j-1.2.6.jar");
> loadPaths[8] = expandPath("irmarkjars\xercesImpl.jar");
> loadPaths[9] = expandPath("irmarkjars\xml-apis.jar");
> loadPaths[10] = expandPath("irmarkjars\xalan.jar");
> loader = createObject("component",
> "javaloader.JavaLoader").init(loadPaths);
> IRMark = loader.create("IRMark");
> ret = IRMark.init("input.xml");
> 
> #ret.doStuff()#
> 
> The java code is:
> public class IRMark  {
>  protected String filename;
>   public IRMark (String filename) throws Exception
>   {
> this.filename=filename;
>   }
>   public String doStuff()throws Exception
>   {
> // Init the Apache XML security library
>   Init.init();
> 
>   // Open the input file
>   FileInputStream fis=null;
>   try {
>   fis=new
> FileInputStream("C:\\CFusionMX7\\wwwroot\\tradesmen\\input.xml");
>   } catch (FileNotFoundException e) {
>   return("The file " + filename + " could not be
> opened.");
>   }
>   // Load file into a byte array
>   byte[] data=null;
>   try {
>   int bytes=fis.available();
>   data=new byte[bytes];
>   fis.read(data);
>   } catch (IOException e) {
>   System.out.println("Error reading file.");
>   e.printStackTrace();
>   return("Error reading file.");
>   }
>   // First part is to run the a transform
over
the
> input to extract the
>   // fragment to be digested. This is done by setting up a
> Transforms
>   // object from a Template and then executing against the
input
> document
>   // The transforms to be performed are specified by using
the
> template XML below.
>   String transformStr =
> "\n"
>   + " xmlns:dsig='http://www.w3.org/2000/09/xmldsig#'
> xmlns:gt='http://www.govtalk.gov.uk/CM/envelope'
> xmlns:ir='http://www.govtalk.gov.uk/taxation/CISrequest'>\n"
>   + "\n"
>   + "\n"
>   + "count(ancestor-or-
> self::node()|/gt:GovTalkMessage/gt:Body)=count(ancestor-or-
> self::node())\n"
>   + " and count(self::ir:IRmark)=0 \n"
>   + " and count(../self::ir:IRmark)=0 \n"
>   + "\n"
>   + "\n"
>   + "\n"
>   + "\n"
>   ;
> 
>   // Parse the transform details to create a document
>   DocumentBuilderFactory
> dbf=DocumentBuilderFactory.newInstance();
>   dbf.setNamespaceAware(true);
>   DocumentBuilder db=dbf.newDocumentBuilder();
>   Document doc=db.parse(new
> ByteArrayInputStream(transformStr.getBytes()));
> 
>   // Construct a Apache security Transforms object from
that
> document
>   Transforms transforms = new
> Transforms(doc.get

RE: CF and Java

2007-04-18 Thread Russ
Looks like something is getting a null pointer, meaning something is not
getting set.  I usually find it easier to create the methods, test them in
java through eclipse (stepping through the debugger if necessary) and once
it's ready to put it to cf.  Basically it's breaking at line 91 in your
file, so either your passing some null variable, or you forgot to set
something, etc.. 

Russ

> -Original Message-
> From: Andrew Whone [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, April 18, 2007 11:01 AM
> To: CF-Talk
> Subject: Re: CF and Java
> 
> I got a bit further on using Mark Mandels Javaloader.
> The coldfusion code is:
> 
> loadPaths = ArrayNew(1);
> loadPaths[1] = expandPath("irmarkjars");
> loadPaths[2] = expandPath("irmarkjars\jce-jdk13-114.jar");
> loadPaths[3] = expandPath("irmarkjars\style-apachexml.jar");
> loadPaths[4] = expandPath("irmarkjars\stylebook-1.0-b3_xalan-2.jar");
> loadPaths[5] = expandPath("irmarkjars\xmlParserAPIs.jar");
> loadPaths[6] = expandPath("irmarkjars\xmlsec.jar");
> loadPaths[7] = expandPath("irmarkjars\jakarta-log4j-1.2.6.jar");
> loadPaths[8] = expandPath("irmarkjars\xercesImpl.jar");
> loadPaths[9] = expandPath("irmarkjars\xml-apis.jar");
> loadPaths[10] = expandPath("irmarkjars\xalan.jar");
> loader = createObject("component",
> "javaloader.JavaLoader").init(loadPaths);
> IRMark = loader.create("IRMark");
> ret = IRMark.init("input.xml");
> 
> #ret.doStuff()#
> 
> The java code is:
> public class IRMark  {
>  protected String filename;
>   public IRMark (String filename) throws Exception
>   {
> this.filename=filename;
>   }
>   public String doStuff()throws Exception
>   {
> // Init the Apache XML security library
>   Init.init();
> 
>   // Open the input file
>   FileInputStream fis=null;
>   try {
>   fis=new
> FileInputStream("C:\\CFusionMX7\\wwwroot\\tradesmen\\input.xml");
>   } catch (FileNotFoundException e) {
>   return("The file " + filename + " could not be
> opened.");
>   }
>   // Load file into a byte array
>   byte[] data=null;
>   try {
>   int bytes=fis.available();
>   data=new byte[bytes];
>   fis.read(data);
>   } catch (IOException e) {
>   System.out.println("Error reading file.");
>   e.printStackTrace();
>   return("Error reading file.");
>   }
>   // First part is to run the a transform over
the
> input to extract the
>   // fragment to be digested. This is done by setting up a
> Transforms
>   // object from a Template and then executing against the
input
> document
>   // The transforms to be performed are specified by using the
> template XML below.
>   String transformStr =
> "\n"
>   + " xmlns:dsig='http://www.w3.org/2000/09/xmldsig#'
> xmlns:gt='http://www.govtalk.gov.uk/CM/envelope'
> xmlns:ir='http://www.govtalk.gov.uk/taxation/CISrequest'>\n"
>   + "\n"
>   + "\n"
>   + "count(ancestor-or-
> self::node()|/gt:GovTalkMessage/gt:Body)=count(ancestor-or-
> self::node())\n"
>   + " and count(self::ir:IRmark)=0 \n"
>   + " and count(../self::ir:IRmark)=0 \n"
>   + "\n"
>   + "\n"
>   + "\n"
>   + "\n"
>   ;
> 
>   // Parse the transform details to create a document
>   DocumentBuilderFactory
> dbf=DocumentBuilderFactory.newInstance();
>   dbf.setNamespaceAware(true);
>   DocumentBuilder db=dbf.newDocumentBuilder();
>   Document doc=db.parse(new
> ByteArrayInputStream(transformStr.getBytes()));
> 
>   // Construct a Apache security Transforms object from that
> document
>   Transforms transforms = new
> Transforms(doc.getDocumentElement(), null);
> 
>   // Now perform the transform on the input to get the
results.
>   XMLSignatureInput input = new XMLSignatureInput(data);
>   XMLSignatureInput result =
> transforms.performTransf

Re: CF and Java

2007-04-18 Thread Andrew Whone
I got a bit further on using Mark Mandels Javaloader.
The coldfusion code is:

loadPaths = ArrayNew(1);
loadPaths[1] = expandPath("irmarkjars");
loadPaths[2] = expandPath("irmarkjars\jce-jdk13-114.jar");
loadPaths[3] = expandPath("irmarkjars\style-apachexml.jar");
loadPaths[4] = expandPath("irmarkjars\stylebook-1.0-b3_xalan-2.jar");
loadPaths[5] = expandPath("irmarkjars\xmlParserAPIs.jar");
loadPaths[6] = expandPath("irmarkjars\xmlsec.jar");
loadPaths[7] = expandPath("irmarkjars\jakarta-log4j-1.2.6.jar");
loadPaths[8] = expandPath("irmarkjars\xercesImpl.jar");
loadPaths[9] = expandPath("irmarkjars\xml-apis.jar");
loadPaths[10] = expandPath("irmarkjars\xalan.jar");
loader = createObject("component", "javaloader.JavaLoader").init(loadPaths);
IRMark = loader.create("IRMark");
ret = IRMark.init("input.xml");

#ret.doStuff()#

The java code is: 
public class IRMark  {
 protected String filename;
  public IRMark (String filename) throws Exception
  {
this.filename=filename; 
}
  public String doStuff()throws Exception
  {
  // Init the Apache XML security library
Init.init();

// Open the input file
FileInputStream fis=null;
try {
fis=new 
FileInputStream("C:\\CFusionMX7\\wwwroot\\tradesmen\\input.xml");
} catch (FileNotFoundException e) {
return("The file " + filename + " could not be 
opened.");
}  
// Load file into a byte array
byte[] data=null;
try {
int bytes=fis.available();
data=new byte[bytes];
fis.read(data);
} catch (IOException e) {
System.out.println("Error reading file.");
e.printStackTrace();
return("Error reading file.");
}
// First part is to run the a transform over 
the input to extract the
// fragment to be digested. This is done by setting up a 
Transforms
// object from a Template and then executing against the input 
document
// The transforms to be performed are specified by using the 
template XML below.
String transformStr =
"\n"
+ "\n"
+ "\n"
+ "\n"
+ 
"count(ancestor-or-self::node()|/gt:GovTalkMessage/gt:Body)=count(ancestor-or-self::node())\n"
+ " and count(self::ir:IRmark)=0 \n"
+ " and count(../self::ir:IRmark)=0 \n"
+ "\n"
+ "\n"
+ "\n"
+ "\n"
;

// Parse the transform details to create a document
DocumentBuilderFactory dbf=DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
DocumentBuilder db=dbf.newDocumentBuilder();
Document doc=db.parse(new 
ByteArrayInputStream(transformStr.getBytes()));

// Construct a Apache security Transforms object from that 
document
Transforms transforms = new 
Transforms(doc.getDocumentElement(), null);

// Now perform the transform on the input to get the results.
XMLSignatureInput input = new XMLSignatureInput(data);
XMLSignatureInput result = transforms.performTransforms(input);

// Uncomment this line to see transform output
//System.out.println(new String(result.getBytes()));

// Second part is to run output via SHA1 digest
// This is done via the standard java.security API
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(result.getBytes());
byte[] digest=md.digest();

// And finally print a Base64 of the digest with
// The help of the BouncyCastle JCE library
System.out.println("IRmark: " + new 
String(Base64.encode(digest)));
return filename;
   }
}
The error message is now:
java.lang.NullPointerException
at 
org.apache.xml.security.transforms.Transform.(Transform.java:195)
at 
org.apache.xml.security.transforms.Transforms.item(Transforms.java:329)
at 
org.apache.xml.security.transforms.Transforms.performTransforms(Transforms.java:256)
at IRMark.doStuff(IRMark.java:91)etc

So I am still trying but things are a bit clearer...mmm.. what now?
A+

~|
Deploy Web Applications Quickly across the enterprise with ColdFusion MX7 & 
Flex 2
Free Trial 
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJU

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:275716
Subscription: http://www.house

RE: CF and Java

2007-04-17 Thread Russ
Also check the CF error log.  I was just having the same kind of proble...
Error 500, I checked the cf log and it said that the class name is not
defined.  Turns out I needed to modify my jar packager to include the new
package that I just added.  

Russ



> -Original Message-
> From: Russ [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, April 17, 2007 12:21 PM
> To: CF-Talk
> Subject: RE: CF and Java
> 
> Does the code work when you run it from java?  In the main method, do
> something like:
> 
> IRMark irmark=new IRMark("somefile.xml");
> System.out.println(irmark.doStuff());
> 
> Russ
> 
> > -Original Message-
> > From: Andrew Whone [mailto:[EMAIL PROTECTED]
> > Sent: Tuesday, April 17, 2007 10:23 AM
> > To: CF-Talk
> > Subject: Re: CF and Java
> >
> > I got Russ's code working but if I do this:
> >  public class IRMark  {
> >  protected String filename;
> >   public IRMark (String filename) throws Exception
> >   {
> > this.filename=filename;
> > // Init the Apache XML security library
> > Init.init();
> > }
> >   public String doStuff()
> >   {
> > return filename;
> >}
> > }
> > I get an Object Instantiation Exception
> > and if i do this
> >  public class IRMark  {
> >  protected String filename;
> >   public IRMark (String filename) throws Exception
> >   {
> > this.filename=filename;
> >
> > }
> >   public String doStuff()
> >   {
> > // Init the Apache XML security library
> > Init.init();
> > return filename;
> >}
> > }
> > I get this
> > 500 org/apache/xml/security/Init
> > org/apache/xml/security/Init
> > no errors
> > I tried the latter with the rest of the code but cannot get anything
> else
> > Any suggestions?
> > A+
> >
> >
> 
> 

~|
Macromedia ColdFusion MX7
Upgrade to MX7 & experience time-saving features, more productivity.
http://www.adobe.com/products/coldfusion?sdid=RVJW

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:275587
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


RE: CF and Java

2007-04-17 Thread Russ
Does the code work when you run it from java?  In the main method, do
something like:

IRMark irmark=new IRMark("somefile.xml");
System.out.println(irmark.doStuff());

Russ

> -Original Message-
> From: Andrew Whone [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, April 17, 2007 10:23 AM
> To: CF-Talk
> Subject: Re: CF and Java
> 
> I got Russ's code working but if I do this:
>  public class IRMark  {
>  protected String filename;
>   public IRMark (String filename) throws Exception
>   {
> this.filename=filename;
>   // Init the Apache XML security library
>   Init.init();
>   }
>   public String doStuff()
>   {
>   return filename;
>}
> }
> I get an Object Instantiation Exception
> and if i do this
>  public class IRMark  {
>  protected String filename;
>   public IRMark (String filename) throws Exception
>   {
> this.filename=filename;
> 
>   }
>   public String doStuff()
>   {
>   // Init the Apache XML security library
>   Init.init();
>   return filename;
>}
> }
> I get this
> 500 org/apache/xml/security/Init
> org/apache/xml/security/Init
> no errors
> I tried the latter with the rest of the code but cannot get anything else
> Any suggestions?
> A+
> 
> 

~|
Create robust enterprise, web RIAs.
Upgrade & integrate Adobe Coldfusion MX7 with Flex 2
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJP

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:275583
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: CF and Java

2007-04-17 Thread Andrew Whone
I got Russ's code working but if I do this:
 public class IRMark  {
 protected String filename;
  public IRMark (String filename) throws Exception
  {
this.filename=filename;
// Init the Apache XML security library
Init.init();
}
  public String doStuff()
  {
return filename;   
   }
}
I get an Object Instantiation Exception
and if i do this
 public class IRMark  {
 protected String filename;
  public IRMark (String filename) throws Exception
  {
this.filename=filename;

}
  public String doStuff()
  {
// Init the Apache XML security library
Init.init();
return filename;   
   }
}
I get this
500 org/apache/xml/security/Init
org/apache/xml/security/Init
no errors
I tried the latter with the rest of the code but cannot get anything else
Any suggestions?
A+

~|
Upgrade to Adobe ColdFusion MX7
The most significant release in over 10 years. Upgrade & see new features.
http://www.adobe.com/products/coldfusion?sdid=RVJR

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:275563
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: CF and Java

2007-04-17 Thread Andrew Whone
I am using 1.4.2

~|
Create robust enterprise, web RIAs.
Upgrade & integrate Adobe Coldfusion MX7 with Flex 2
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJP

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:275523
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: CF and Java

2007-04-16 Thread Mark Mandel
Stupid question, but what JDK are you using to compile the Java code?

CF uses 1.4.x, so make sure you use a 1.4 JDK to compile the code.

If you use a 1.5+ compiler, you will run into issues.

Mark

On 4/17/07, Russ <[EMAIL PROTECTED]> wrote:
> AFAIK, the main method is not meant to be called by any other classes... it's 
> only meant to be called when the program is directly executed.
>
> Take all the code from the main method, and put it into its own method.  Call 
> that method.  Use the main method only when testing the app directly from 
> eclipse or command line.  (you can instantiate a class of itself and then 
> call the methods of that object).
>
> Try the code I posted earlier, and see if that works from CF.  Once you get 
> that working, then put in your actual code.
>
> Once again,  even if you do get the main somehow executing, it's poor coding 
> practices and will cause you more problems in the long run.  Your code should 
> be properly structured.
>
> Russ
>
> > -Original Message-
> > From: Andrew Whone [mailto:[EMAIL PROTECTED]
> > Sent: Monday, April 16, 2007 11:50 AM
> > To: CF-Talk
> > Subject: Re: CF and Java
> >
> > I tried that and it's still the same error message so presumably the array
> > is problematic but should work see:
> > http://weblogs.macromedia.com/cantrell/archives/2003/06/passing_coldfus.cf
> > m
> >
> > I put the blank constructor in the code thus:
> >
> > public class IRMark {
> >/**
> > * Generate and print the IRmark.
> > *
> > * @param args - Pass the filename of the input document
> > * @throws Exception
> > */
> >   public IRMark() {}
> >   public static void main(String args[]) throws Exception {
> >
> >   // Init the Apache XML security library
> >   Init.init();
> > ...etc
> > I am wiser but no further on.
> > Any more suggestions much appreciated.
> > A+
> >
> >
>
> 

~|
Upgrade to Adobe ColdFusion MX7
Experience Flex 2 & MX7 integration & create powerful cross-platform RIAs
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJQ 

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:275479
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


RE: CF and Java

2007-04-16 Thread Russ
AFAIK, the main method is not meant to be called by any other classes... it's 
only meant to be called when the program is directly executed.  

Take all the code from the main method, and put it into its own method.  Call 
that method.  Use the main method only when testing the app directly from 
eclipse or command line.  (you can instantiate a class of itself and then call 
the methods of that object).  

Try the code I posted earlier, and see if that works from CF.  Once you get 
that working, then put in your actual code.  

Once again,  even if you do get the main somehow executing, it's poor coding 
practices and will cause you more problems in the long run.  Your code should 
be properly structured. 

Russ

> -Original Message-
> From: Andrew Whone [mailto:[EMAIL PROTECTED]
> Sent: Monday, April 16, 2007 11:50 AM
> To: CF-Talk
> Subject: Re: CF and Java
> 
> I tried that and it's still the same error message so presumably the array
> is problematic but should work see:
> http://weblogs.macromedia.com/cantrell/archives/2003/06/passing_coldfus.cf
> m
> 
> I put the blank constructor in the code thus:
> 
> public class IRMark {
>/**
> * Generate and print the IRmark.
> *
> * @param args - Pass the filename of the input document
> * @throws Exception
> */
>   public IRMark() {}
>   public static void main(String args[]) throws Exception {
> 
>   // Init the Apache XML security library
>   Init.init();
> ...etc
> I am wiser but no further on.
> Any more suggestions much appreciated.
> A+
> 
> 

~|
Upgrade to Adobe ColdFusion MX7
Experience Flex 2 & MX7 integration & create powerful cross-platform RIAs
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJQ 

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:275391
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: CF and Java

2007-04-16 Thread Andrew Whone
I tried that and it's still the same error message so presumably the array is 
problematic but should work see: 
http://weblogs.macromedia.com/cantrell/archives/2003/06/passing_coldfus.cfm

I put the blank constructor in the code thus:
 
public class IRMark {
   /**
* Generate and print the IRmark.
*
* @param args - Pass the filename of the input document
* @throws Exception
*/
public IRMark() {} 
public static void main(String args[]) throws Exception {

// Init the Apache XML security library
Init.init();
...etc
I am wiser but no further on.
Any more suggestions much appreciated.
A+

~|
ColdFusion MX7 and Flex 2 
Build sales & marketing dashboard RIA’s for your business. Upgrade now
http://www.adobe.com/products/coldfusion/flex2?sdid=RVJT

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:275386
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: CF and Java

2007-04-16 Thread Phillip Duba
Ok, than what Mark and Dave wrote (and Russ just added) will have to be
done. Your code should like like:

In the Java class, create a blank constructor:

public IRMark() { }

Within your ColdFusion logic:




jArray = aFileName.toArray();





That should work. CF hasn't really considered the Java object an
instance until the constructor is called. HTH,

Phil

-Original Message-
From: Andrew Whone [mailto:[EMAIL PROTECTED] 
Sent: Monday, April 16, 2007 9:58 AM
To: CF-Talk
Subject: Re: CF and Java

>Andrew,
>
>My 1.2 referred to version 1.2 of the Apache XML Security Library:
>http://xml.apache.org/security/dist/java-library/old/xml-security-bin-1
_
>2_0.zip. I did have to upgrade to the 1.2.96 version of the xmlsec.jar
>file:
>http://xml.apache.org/security/dist/java-library/old/xmlsec-1.2.96.jar.
>What is the exact error you are receiving? Can you look in the CF logs
>or run debugging to capture the error message? Thanks,
>
>Phil
Phil
>From the application.log
"Error","web-4","04/16/07","15:03:39",,"The selected method main was not
found.Either there are no methods with the specified method name and
argument types, or the method main is overloaded with arguments types
that ColdFusion can't decipher reliably. If this is a Java object and
you verified that the method exists, you may need to use the javacast
function to reduce ambiguity. The specific sequence of files included or
processed is: C:\CFusionMX7\wwwroot\tradesmen\tradesman1
\CIS\CISverify1.cfm, line: 339 "
A+



~|
Create Web Applications With ColdFusion MX7 & Flex 2. 
Build powerful, scalable RIAs. Free Trial
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJS 

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:275364
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: CF and Java

2007-04-16 Thread Andrew Whone
>Andrew,
>
>My 1.2 referred to version 1.2 of the Apache XML Security Library:
>http://xml.apache.org/security/dist/java-library/old/xml-security-bin-1_
>2_0.zip. I did have to upgrade to the 1.2.96 version of the xmlsec.jar
>file:
>http://xml.apache.org/security/dist/java-library/old/xmlsec-1.2.96.jar.
>What is the exact error you are receiving? Can you look in the CF logs
>or run debugging to capture the error message? Thanks,
>
>Phil
Phil
>From the application.log
"Error","web-4","04/16/07","15:03:39",,"The selected method main was not 
found.Either there are no methods with the specified method name and argument 
types, or the method main is overloaded with arguments types that ColdFusion 
can't decipher reliably. If this is a Java object and you verified that the 
method exists, you may need to use the javacast function to reduce ambiguity. 
The specific sequence of files included or processed is: 
C:\CFusionMX7\wwwroot\tradesmen\tradesman1
\CIS\CISverify1.cfm, line: 339 "
A+

~|
Upgrade to Adobe ColdFusion MX7
The most significant release in over 10 years. Upgrade & see new features.
http://www.adobe.com/products/coldfusion?sdid=RVJR

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:275360
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


RE: CF and Java

2007-04-16 Thread Russ
Andrew, 

If you have control of the java code (and I assume you do), I would recode it 
to have a separate constructor, and a method (or methods) that actually do 
stuff.  The constructor should be named the same as the class, and in your case 
take in a string (assuming you want to pass in a single xml file at a time).  

The java code should look something like this.  You will implement the doStuff 
method (or whatever it make sense to call it to do your actual conversion and 
return the base64 string).  

  public class IRMark {
 protected String filename;
public IRMMark (String filename)
{
this. filename =filename;
Init.init();
}
  public String doStuff()
  {
 return filename;
  }
}

In ColdFusion you would do something like this




I would start with this code (maybe commenting out the Init.init() in java for 
now, and then see if it succeeds.  Then I would start adding the code that 
actually does stuff. 

You will need to restart CF when you make code changes.  If you are going to be 
doing this a lot, I suggest getting Mark Mandel's JavaLoader.cfc.  It has 
greatly eased my Java/CF development.  

Russ
> -Original Message-
> From: Andrew Whone [mailto:[EMAIL PROTECTED]
> Sent: Monday, April 16, 2007 9:24 AM
> To: CF-Talk
> Subject: Re: CF and Java
> 
> Thanks for all the help but still no joy.
> I have been compiling the class file in the classes library and not moving
> it.
> All the jars are in the class path.
> I have been calling the method using:
> 
>   
> And
> 
> 
> 
> jArray = aFileName.toArray();
> 
> 
>   
> I am using xmlsec 1.0 (I am not sure what the 1.2 refers to in Phils
> reply)
> I do have a log4j.jar in C:\CFusionMX7\lib so there is a probably a
> conflict but I don't know how to solve it.
> The error message I get is always HTTP500 The web page cannot be
> displayed.
> I received another reply in the Java forum of this site, so I tried that
> code and still get the same error.
> Any more help will begratefully received.
> A+
> 
> 

~|
ColdFusion MX7 and Flex 2 
Build sales & marketing dashboard RIA’s for your business. Upgrade now
http://www.adobe.com/products/coldfusion/flex2?sdid=RVJT

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:275358
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


RE: CF and Java

2007-04-16 Thread Phillip Duba
Andrew,

My 1.2 referred to version 1.2 of the Apache XML Security Library:
http://xml.apache.org/security/dist/java-library/old/xml-security-bin-1_
2_0.zip. I did have to upgrade to the 1.2.96 version of the xmlsec.jar
file:
http://xml.apache.org/security/dist/java-library/old/xmlsec-1.2.96.jar.
What is the exact error you are receiving? Can you look in the CF logs
or run debugging to capture the error message? Thanks,

Phil



~|
Upgrade to Adobe ColdFusion MX7
The most significant release in over 10 years. Upgrade & see new features.
http://www.adobe.com/products/coldfusion?sdid=RVJR

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:275352
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: CF and Java

2007-04-16 Thread Andrew Whone
Thanks for all the help but still no joy.
I have been compiling the class file in the classes library and not moving it.
All the jars are in the class path.
I have been calling the method using:

  
And



jArray = aFileName.toArray();


  
I am using xmlsec 1.0 (I am not sure what the 1.2 refers to in Phils reply)
I do have a log4j.jar in C:\CFusionMX7\lib so there is a probably a conflict 
but I don't know how to solve it.
The error message I get is always HTTP500 The web page cannot be displayed.
I received another reply in the Java forum of this site, so I tried that code 
and still get the same error.
Any more help will begratefully received.
A+

~|
ColdFusion MX7 and Flex 2 
Build sales & marketing dashboard RIA’s for your business. Upgrade now
http://www.adobe.com/products/coldfusion/flex2?sdid=RVJT

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:275347
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: CF and Java

2007-04-16 Thread Andrew Whone
>Dave's right on the different log4j version. What version of the
>security library are you using? I had to go back to 1.2 and
>xmlsec-1.2.96.jar to get my signature validation to work with CF's JRE,
>
>Phil
>
>-Original Message-
>From: Dave Watts [mailto:[EMAIL PROTECTED] 
>Sent: Friday, April 13, 2007 12:24 PM
>To: CF-Talk
>Subject: RE: CF and Java
>
>Your class doesn't appear to have an init method of its own. The fact
>that
>it's calling an init method in another class shouldn't matter, I think.
>
>CF comes with a specific version of log4j, which may be conflicting with
>yours.
>
>What exactly is the error you get?
>
>Dave Watts, CTO, Fig Leaf Software
>http://www.figleaf.com/
>
>Fig Leaf Software provides the highest caliber vendor-authorized
>instruction at our training centers in Washington DC, Atlanta,
>Chicago, Baltimore, Northern Virginia, or on-site at your location.
>Visit http://training.figleaf.com/ for more information!
>
>This email has been processed by SmoothZap - www.smoothwall.net

~|
Upgrade to Adobe ColdFusion MX7
The most significant release in over 10 years. Upgrade & see new features.
http://www.adobe.com/products/coldfusion?sdid=RVJR

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:275346
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: CF and Java

2007-04-15 Thread Phillip Duba
Dave's right on the different log4j version. What version of the
security library are you using? I had to go back to 1.2 and
xmlsec-1.2.96.jar to get my signature validation to work with CF's JRE,

Phil

-Original Message-
From: Dave Watts [mailto:[EMAIL PROTECTED] 
Sent: Friday, April 13, 2007 12:24 PM
To: CF-Talk
Subject: RE: CF and Java

Your class doesn't appear to have an init method of its own. The fact
that
it's calling an init method in another class shouldn't matter, I think.

CF comes with a specific version of log4j, which may be conflicting with
yours.

What exactly is the error you get?

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/

Fig Leaf Software provides the highest caliber vendor-authorized
instruction at our training centers in Washington DC, Atlanta,
Chicago, Baltimore, Northern Virginia, or on-site at your location.
Visit http://training.figleaf.com/ for more information!

This email has been processed by SmoothZap - www.smoothwall.net




~|
Upgrade to Adobe ColdFusion MX7
The most significant release in over 10 years. Upgrade & see new features.
http://www.adobe.com/products/coldfusion?sdid=RVJR

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:275267
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: CF and Java

2007-04-13 Thread Mark Mandel
Andrew,

Your code should be running the 'main' method that is defined in the Java code.

There is no constructor, for this class, so you code will fail.

You will need to create a String[], which is relatively easy using the
java.lang.reflect.Array Java class, and pass it into the main() method
(CF may actually do the translation for you if you use just a regular
Array, it may be worth checking).

Once you have your array, pass it in as an argument to the main()
method, and you should have what you need.

Mark

On 4/14/07, Phillip Duba <[EMAIL PROTECTED]> wrote:
> Andrew,
>
> I ran into this same issue doing stuff with SAML. Make sure you haven't
> moved the class file after it has been compiled. In other words, once
> you compile the Java class, you can't move it around to the classes
> library or some other directory. I don't know why, but ever time I moved
> my class file, the Init.init() call would fail. Also, ensure all the
> Apache XML libraries are in your CF classpath. Finally, you don't have a
> constructor on your class so your call should be:  myObj.main("input.xml")>. HTH,
>
> Phil
>
> -Original Message-
> From: Andrew Whone [mailto:[EMAIL PROTECTED]
> Sent: Friday, April 13, 2007 10:53 AM
> To: CF-Talk
> Subject: CF and Java
>
> I have some java code which I want to kick in from a coldfusion page
>
> e.g. 
>   
> It ought to be simple enough, pass the file name to the class and get
> the base64 number back.
> The Coldfusion documentation states:
> "Note: The init method is not a method of the object, but a ColdFusion
> identifier that calls the new function on the class constructor. So, if
> a Java object has an init method, a name conflict exists and you cannot
> call the object's init method."
> and I suspect this is where my problem lies but my java is still basic.
> I would be very grateful if anyone could at least give me a few pointers
> to solve this problem. I have tried lots of things without any success.
>
> The Java Code:
>
> import java.io.*;
> import javax.xml.parsers.*;
> import java.security.*;
>
> import org.w3c.dom.*;
>
> import org.apache.xml.security.signature.*;
> import org.apache.xml.security.transforms.*;
> import org.apache.xml.security.Init;
>
> import org.bouncycastle.util.encoders.Base64;
>
>
> /**
>  * This code generates an IRmark value for an input document.
>  * The value is a base64 encoded SHA1 digest of a signature
>  * transform over a certain style of document. The value has
>  * to be placed inside documents to be signed by the XPE when
>  * used in a EDS/IR deployment.
>  *
>  * The code has a number of jar dependencies:-
>  *  xmlsec.jar - The Apache XML Security Library
>  *  log4j-1.2.5.jar - The Apache Log utility
>  *  xalan.jar - Apache XSLT/XPath processor
>  *  xercesImpl.jar - Apache XML processor
>  *  bc-jce-jdk13-114.jar - Bouncy Castle JCE library
>  *
>  *  The Bouncy Castle JCE provider is automatically downloaded
>  *  by the Apache XML sec library build so you may already have
>  *  that.
>  */
>
>
>public class IRMark {
>
>/**
> * Generate and print the IRmark.
> *
> * @param args - Pass the filename of the input document
> * @throws Exception
> */
> public static void main(String args[]) throws Exception {
>
> // Init the Apache XML security library
> Init.init();
>
> // Check we are given a file to work with
> if (args.length!=1) {
> System.out.println("Use: IRmark  ");
> return;
> }
>
> // Open the input file
> FileInputStream fis=null;
> try {
> fis=new FileInputStream(args[0]);
> } catch (FileNotFoundException e) {
> System.out.println("The file " + args[0] + "
> could not be opened.");
> return;
> }
>
> // Load file into a byte array
> byte[] data=null;
> try {
> int bytes=fis.available();
> data=new byte[bytes];
> fis.read(data);
> } catch (IOException e) {
> System.out.println("Error reading file.");
> e.printStackTrace();
> }
>
> // First part is to run the a transform over the input
> to extract the
> // fragment to be digested. This is done by setting up a
> Transforms
> // object from a Template and then executing against the
> input document
>
> // The transforms to be performed are specified by using
> the template XML below.
> String transformStr =
> "\n"
> + " xmlns:dsig='http://www.w3.org/2000/09/xmldsig#'
> xmlns:gt='http://www.govtalk.gov.uk/CM/envelope'
> xmlns:ir='http://www.govtalk.gov.uk/taxation/CISreq

RE: CF and Java

2007-04-13 Thread Phillip Duba
Andrew,

I ran into this same issue doing stuff with SAML. Make sure you haven't
moved the class file after it has been compiled. In other words, once
you compile the Java class, you can't move it around to the classes
library or some other directory. I don't know why, but ever time I moved
my class file, the Init.init() call would fail. Also, ensure all the
Apache XML libraries are in your CF classpath. Finally, you don't have a
constructor on your class so your call should be: . HTH,

Phil

-Original Message-
From: Andrew Whone [mailto:[EMAIL PROTECTED] 
Sent: Friday, April 13, 2007 10:53 AM
To: CF-Talk
Subject: CF and Java

I have some java code which I want to kick in from a coldfusion page

e.g. 
   ");
return;
}

// Open the input file
FileInputStream fis=null;
try {
fis=new FileInputStream(args[0]);
} catch (FileNotFoundException e) {
System.out.println("The file " + args[0] + "
could not be opened.");
return;
}

// Load file into a byte array
byte[] data=null;
try {
int bytes=fis.available();
data=new byte[bytes];
fis.read(data);
} catch (IOException e) {
System.out.println("Error reading file.");
e.printStackTrace();
}

// First part is to run the a transform over the input
to extract the
// fragment to be digested. This is done by setting up a
Transforms
// object from a Template and then executing against the
input document

// The transforms to be performed are specified by using
the template XML below.
String transformStr =
"\n"
+ "\n"
+ "\n"
+ "\n"
+
"count(ancestor-or-self::node()|/gt:GovTalkMessage/gt:Body)=count(ancest
or-or-self::node())\n"
+ " and count(self::ir:IRmark)=0 \n"
+ " and count(../self::ir:IRmark)=0 \n"
+ "\n"
+ "\n"
+ "\n"
+ "\n"
;

// Parse the transform details to create a document
DocumentBuilderFactory
dbf=DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
DocumentBuilder db=dbf.newDocumentBuilder();
Document doc=db.parse(new
ByteArrayInputStream(transformStr.getBytes()));

// Construct a Apache security Transforms object from
that document
Transforms transforms = new
Transforms(doc.getDocumentElement(), null);

// Now perform the transform on the input to get the
results.
XMLSignatureInput input = new XMLSignatureInput(data);
XMLSignatureInput result = transforms.performTransforms(input);

// Uncomment this line to see transform output
// System.out.println(new String(result.getBytes()));

// Second part is to run output via SHA1 digest
// This is done via the standard java.security API
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(result.getBytes());
byte[] digest=md.digest();

// And finally print a Base64 of the digest with
// The help of the BouncyCastle JCE library
System.out.println("IRmark: " + new
String(Base64.encode(digest)));
   }
}
Thanks A+



~|
Create Web Applications With ColdFusion MX7 & Flex 2. 
Build powerful, scalable RIAs. Free Trial
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJS 

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:275160
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


RE: CF and Java

2007-04-13 Thread Dave Watts
> I have some java code which I want to kick in from a coldfusion page
> 
> e.g. 
>
> It ought to be simple enough, pass the file name to the class 
> and get the base64 number back.
> The Coldfusion documentation states: 
> "Note: The init method is not a method of the object, but a 
> ColdFusion identifier that calls the new function on the 
> class constructor. So, if a Java object has an init method, a 
> name conflict exists and you cannot call the object’s init method."
> and I suspect this is where my problem lies but my java is 
> still basic. I would be very grateful if anyone could at 
> least give me a few pointers to solve this problem. I have 
> tried lots of things without any success.

Your class doesn't appear to have an init method of its own. The fact that
it's calling an init method in another class shouldn't matter, I think.

CF comes with a specific version of log4j, which may be conflicting with
yours.

What exactly is the error you get?

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/

Fig Leaf Software provides the highest caliber vendor-authorized
instruction at our training centers in Washington DC, Atlanta,
Chicago, Baltimore, Northern Virginia, or on-site at your location.
Visit http://training.figleaf.com/ for more information!

This email has been processed by SmoothZap - www.smoothwall.net


~|
ColdFusion MX7 and Flex 2 
Build sales & marketing dashboard RIA’s for your business. Upgrade now
http://www.adobe.com/products/coldfusion/flex2?sdid=RVJT

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:275151
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: CF and Java Interfaces

2005-06-09 Thread Chris Terrebonne
Actually that's exactly what I'm using.  I had it lying around for CFEclipse, 
but it just never stuck (Homesite/CFStudio kept calling be back).  But for 
Java, it's great.  Not really a raving review considering I haven't tried any 
other Java IDE's.  At this point it does everything I need it to so it's 
perfect for me.

Thanks,
Chris

>>> [EMAIL PROTECTED] 06/09/05 11:40AM >>>
While we're on the topic..

If you find yourself doing Java, the Eclipse IDE is a great platform
for it.  And there's the CFEclipse plugin that includes CF editors and
various other things, so you can do your CF work in the same
application.  And it itegrates easily with myriad version control
systems too.  Very nice package.

cheers,
barneyb

On 6/9/05, Chris Terrebonne <[EMAIL PROTECTED]> wrote:
> Thanks Nathan and Barney for clearing this up for me.
> 
> I guess this was as perfect excuse as any to finally learn Java.  Man!  I was 
> surprised how simple it was.  I know C++ and I heard that the transition to 
> Java was easy, but I had no idea just how easy it was.  I should have done 
> this along time ago.  I know this is starting to drift into OT-land but... 
> it's nice to just code away without worrying about memory management.  If I 
> never malloc again... it will be too soon ;).
> 
> Thanks for the inadvertent "push", guys.
> 
> Chris


-- 
Barney Boisvert
[EMAIL PROTECTED] 
360.319.6145
http://www.barneyb.com/ 

Got Gmail? I have 50 invites.



~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble 
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:209141
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54


Re: CF and Java Interfaces

2005-06-09 Thread Barney Boisvert
While we're on the topic..

If you find yourself doing Java, the Eclipse IDE is a great platform
for it.  And there's the CFEclipse plugin that includes CF editors and
various other things, so you can do your CF work in the same
application.  And it itegrates easily with myriad version control
systems too.  Very nice package.

cheers,
barneyb

On 6/9/05, Chris Terrebonne <[EMAIL PROTECTED]> wrote:
> Thanks Nathan and Barney for clearing this up for me.
> 
> I guess this was as perfect excuse as any to finally learn Java.  Man!  I was 
> surprised how simple it was.  I know C++ and I heard that the transition to 
> Java was easy, but I had no idea just how easy it was.  I should have done 
> this along time ago.  I know this is starting to drift into OT-land but... 
> it's nice to just code away without worrying about memory management.  If I 
> never malloc again... it will be too soon ;).
> 
> Thanks for the inadvertent "push", guys.
> 
> Chris


-- 
Barney Boisvert
[EMAIL PROTECTED]
360.319.6145
http://www.barneyb.com/

Got Gmail? I have 50 invites.

~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble 
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:209127
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54


Re: CF and Java Interfaces

2005-06-09 Thread Chris Terrebonne
Thanks Nathan and Barney for clearing this up for me.  

I guess this was as perfect excuse as any to finally learn Java.  Man!  I was 
surprised how simple it was.  I know C++ and I heard that the transition to 
Java was easy, but I had no idea just how easy it was.  I should have done this 
along time ago.  I know this is starting to drift into OT-land but... it's nice 
to just code away without worrying about memory management.  If I never malloc 
again... it will be too soon ;).  

Thanks for the inadvertent "push", guys.  

Chris

>>> [EMAIL PROTECTED] 06/08/05 01:26PM >>>
Perhaps there's already a java object that impliments this interface? 
Look around to see if there's anything that impliments your target 
class. Otherwise, you could make one in java and createObject() it in CF.

-nathan strutz


Chris Terrebonne wrote:
> I am trying to use CF to access a Java class method.  One of the required 
> arguments is an object extended from an interface.  Using createObject() to 
> instantiate the object, then passing it to the method as an argument causes 
> an error because the interface is abstract and must be extended.  Since 
> cfcomponent won't allow me to extend a Java interface, how can I use this 
> interface?  Any suggestions?
> 
> Thanks,
> Chris
> 
> 
> This email and its attachments may contain confidential information 
> which is intended only for the use of the person(s) named above.  
> If you are not the intended recipient, you are hereby advised that
> any disclosure, copying, distribution or the taking of any action
> based on the contents of this information is prohibited.  If you 
> have received this transmission in error, please notify the sender
> and delete this email from your computer.  Thank you.
> 
> 
> 
> 



~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:209080
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54


Re: CF and Java Interfaces

2005-06-08 Thread Nathan Strutz
Perhaps there's already a java object that impliments this interface? 
Look around to see if there's anything that impliments your target 
class. Otherwise, you could make one in java and createObject() it in CF.

-nathan strutz


Chris Terrebonne wrote:
> I am trying to use CF to access a Java class method.  One of the required 
> arguments is an object extended from an interface.  Using createObject() to 
> instantiate the object, then passing it to the method as an argument causes 
> an error because the interface is abstract and must be extended.  Since 
> cfcomponent won't allow me to extend a Java interface, how can I use this 
> interface?  Any suggestions?
> 
> Thanks,
> Chris
> 
> 
> This email and its attachments may contain confidential information 
> which is intended only for the use of the person(s) named above.  
> If you are not the intended recipient, you are hereby advised that
> any disclosure, copying, distribution or the taking of any action
> based on the contents of this information is prohibited.  If you 
> have received this transmission in error, please notify the sender
> and delete this email from your computer.  Thank you.
> 
> 
> 
> 

~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:209013
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54


Re: CF and Java Interfaces

2005-06-08 Thread Barney Boisvert
You can only use the interface on Java objects.  So you'll need a
concrete Java object that implements the interface.  Just instantiate
that concrete object and pass it into your method.

The type system that CF uses is entirely divorced from the type system
that Java uses.  There are a couple places of overlap (like you can
pass a CF number in as a Java Double), but that's it.

cheers,
barneyb

On 6/8/05, Chris Terrebonne <[EMAIL PROTECTED]> wrote:
> I am trying to use CF to access a Java class method.  One of the required 
> arguments is an object extended from an interface.  Using createObject() to 
> instantiate the object, then passing it to the method as an argument causes 
> an error because the interface is abstract and must be extended.  Since 
> cfcomponent won't allow me to extend a Java interface, how can I use this 
> interface?  Any suggestions?
> 
> Thanks,
> Chris
> 

-- 
Barney Boisvert
[EMAIL PROTECTED]
360.319.6145
http://www.barneyb.com/

Got Gmail? I have 50 invites.

~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble 
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:209012
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54


RE: CF and Java integration..

2003-11-19 Thread Hassan Arteaga Rodriguez
Thanks a lot !!

--
M.Sc. Hassan Arteaga Rodríguez.
Microsoft Certified System Engineer.
Grupo de Desarrollo. DIGI
COPEXTEL, S.A

-Original Message-
From: Craig Dudley [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, November 19, 2003 3:09 AM
To: CF-Talk
Subject: RE: CF and Java integration..

Not specific to CFMX< but have a look at http://javaalmanac.com/egs/?

Some very useful examples.

-Original Message-
From: Hassan Arteaga Rodriguez
[mailto:[EMAIL PROTECTED] 
Sent: 18 November 2003 22:26
To: CF-Talk
Subject: CF and Java integration..

Hi all:

I'm looking for a Java reference in PDF or chm format about the
most
used packages and short examples. 
I'd like to start  develop some examples with CF MX 6.1 using
java
classes. Just to start !!!

*in CFLib.org it's a good example how to implement zip features
with
java.util.zip package

Regards, 

--
M.Sc. Hassan Arteaga Rodríguez.
Microsoft Certified System Engineer.
Grupo de Desarrollo. DIGI
COPEXTEL, S.A

  _  

  _  


 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




RE: CF and Java integration..

2003-11-19 Thread Craig Dudley
Not specific to CFMX< but have a look at http://javaalmanac.com/egs/?

 
Some very useful examples.

	-Original Message-
	From: Hassan Arteaga Rodriguez
[mailto:[EMAIL PROTECTED] 
	Sent: 18 November 2003 22:26
	To: CF-Talk
	Subject: CF and Java integration..
	
	
	Hi all:
	
	
	I'm looking for a Java reference in PDF or chm format about the
most
	used packages and short examples. 
	I'd like to start  develop some examples with CF MX 6.1 using
java
	classes. Just to start !!!
	
	
	*in CFLib.org it's a good example how to implement zip features
with
	java.util.zip package
	
	
	Regards, 
	
	--
	M.Sc. Hassan Arteaga Rodríguez.
	Microsoft Certified System Engineer.
	Grupo de Desarrollo. DIGI
	COPEXTEL, S.A
	
	
	
  _  

	
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]