Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » Java via Epsilon Tools
Java via Epsilon Tools [message #482096] Tue, 25 August 2009 11:23 Go to next message
Eclipse UserFriend
Originally posted by: d.clowes.lboro.ac.uk

Hi All,

I'm trying to execute some regular expression searches in a
transformation. The Java I need to execute uses the
Java.utils.regex.Pattern and Java.utils.regex.Matcher. Dimtitris kindly
pointed me to the Epsilon Tools documentation and I can follow the JFrame
example. However from what I can tell there is no default constructor for
Pattern, which is what I believe to be causing me the problems.

Pattern is typically called in Java by:
Pattern p = Pattern.compile('regex Srring');

I have tried:
# var pattern : new Native('java.util.regex.Pattern') :=
pattern.compile('Section ((\\d)[(\\.\\d)]*)');
# var pattern : new Native('java.util.regex.Pattern') :=
Pattern.compile('Section ((\\d)[(\\.\\d)]*)');
# var pattern : new Native('java.util.regex.Pattern') :=
java.util.regex.Pattern.compile('Section ((\\d)[(\\.\\d)]*)');
# var pattern : new Native('java.util.regex.Pattern');

All of which result in an EXCEPTION: Internal error:
java.lang.InstantiationException: java.util.regex.Pattern

Has anyone any suggestions to try.

Many thanks,

Darren
Re: Java via Epsilon Tools [message #482108 is a reply to message #482096] Tue, 25 August 2009 11:53 Go to previous messageGo to next message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi Darren,

Since Pattern doesn't provide an accessible constructor - only the
static "compile" method, you should create your own tool that wraps
Pattern (using Java) and then call it from Epsilon.

Having said this, calling static methods seems like a useful feature
that should be supported natively by Epsilon. Would you mind opening an
enhancement request in the bugzilla for this?

Cheers,
Dimitris

Darren Clowes wrote:
> Hi All,
>
> I'm trying to execute some regular expression searches in a
> transformation. The Java I need to execute uses the
> Java.utils.regex.Pattern and Java.utils.regex.Matcher. Dimtitris kindly
> pointed me to the Epsilon Tools documentation and I can follow the
> JFrame example. However from what I can tell there is no default
> constructor for Pattern, which is what I believe to be causing me the
> problems.
>
> Pattern is typically called in Java by:
> Pattern p = Pattern.compile('regex Srring');
>
> I have tried:
> # var pattern : new Native('java.util.regex.Pattern') :=
> pattern.compile('Section ((\\d)[(\\.\\d)]*)');
> # var pattern : new Native('java.util.regex.Pattern') :=
> Pattern.compile('Section ((\\d)[(\\.\\d)]*)');
> # var pattern : new Native('java.util.regex.Pattern') :=
> java.util.regex.Pattern.compile('Section ((\\d)[(\\.\\d)]*)');
> # var pattern : new Native('java.util.regex.Pattern');
>
> All of which result in an EXCEPTION: Internal error:
> java.lang.InstantiationException: java.util.regex.Pattern
>
> Has anyone any suggestions to try.
>
> Many thanks,
>
> Darren
>
Re: Java via Epsilon Tools [message #482114 is a reply to message #482108] Tue, 25 August 2009 12:22 Go to previous messageGo to next message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi Darren,

If you are using Epsilon from source, please update and then you can
simply write the following:

var pattern = Native('java.util.regex.Pattern').compile('\\d');

var matcher = pattern.matcher('Some text and 1 digit');

while (matcher.find()) {
matcher.start().println();
matcher.group().println();
matcher.end().println();
}

The change will appear in 0.8.7 - which should be released within the
next couple of days. I'll also update the EGL/Tomcat integration shortly.

Cheers,
Dimitris

Dimitris Kolovos wrote:
> Hi Darren,
>
> Since Pattern doesn't provide an accessible constructor - only the
> static "compile" method, you should create your own tool that wraps
> Pattern (using Java) and then call it from Epsilon.
>
> Having said this, calling static methods seems like a useful feature
> that should be supported natively by Epsilon. Would you mind opening an
> enhancement request in the bugzilla for this?
>
> Cheers,
> Dimitris
>
> Darren Clowes wrote:
>> Hi All,
>>
>> I'm trying to execute some regular expression searches in a
>> transformation. The Java I need to execute uses the
>> Java.utils.regex.Pattern and Java.utils.regex.Matcher. Dimtitris
>> kindly pointed me to the Epsilon Tools documentation and I can follow
>> the JFrame example. However from what I can tell there is no default
>> constructor for Pattern, which is what I believe to be causing me the
>> problems.
>>
>> Pattern is typically called in Java by:
>> Pattern p = Pattern.compile('regex Srring');
>>
>> I have tried:
>> # var pattern : new Native('java.util.regex.Pattern') :=
>> pattern.compile('Section ((\\d)[(\\.\\d)]*)');
>> # var pattern : new Native('java.util.regex.Pattern') :=
>> Pattern.compile('Section ((\\d)[(\\.\\d)]*)');
>> # var pattern : new Native('java.util.regex.Pattern') :=
>> java.util.regex.Pattern.compile('Section ((\\d)[(\\.\\d)]*)');
>> # var pattern : new Native('java.util.regex.Pattern');
>>
>> All of which result in an EXCEPTION: Internal error:
>> java.lang.InstantiationException: java.util.regex.Pattern
>>
>> Has anyone any suggestions to try.
>>
>> Many thanks,
>>
>> Darren
>>
Re: Java via Epsilon Tools [message #482121 is a reply to message #482108] Tue, 25 August 2009 12:47 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: d.clowes.lboro.ac.uk

I think I created that correctly you should find the request available at:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=287549

Darren.
Re: Java via Epsilon Tools [message #482131 is a reply to message #482121] Tue, 25 August 2009 13:12 Go to previous message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Thanks Darren. For some reason I didn't receive a notification from the
bugzilla and opened this

https://bugs.eclipse.org/bugs/show_bug.cgi?id=287548

I've marked the one as a duplicate of the other so that's fine now.

Cheers,
Dimitris

Darren Clowes wrote:
> I think I created that correctly you should find the request available at:
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=287549
>
> Darren.
>
Re: Java via Epsilon Tools [message #579507 is a reply to message #482096] Tue, 25 August 2009 11:53 Go to previous message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi Darren,

Since Pattern doesn't provide an accessible constructor - only the
static "compile" method, you should create your own tool that wraps
Pattern (using Java) and then call it from Epsilon.

Having said this, calling static methods seems like a useful feature
that should be supported natively by Epsilon. Would you mind opening an
enhancement request in the bugzilla for this?

Cheers,
Dimitris

Darren Clowes wrote:
> Hi All,
>
> I'm trying to execute some regular expression searches in a
> transformation. The Java I need to execute uses the
> Java.utils.regex.Pattern and Java.utils.regex.Matcher. Dimtitris kindly
> pointed me to the Epsilon Tools documentation and I can follow the
> JFrame example. However from what I can tell there is no default
> constructor for Pattern, which is what I believe to be causing me the
> problems.
>
> Pattern is typically called in Java by:
> Pattern p = Pattern.compile('regex Srring');
>
> I have tried:
> # var pattern : new Native('java.util.regex.Pattern') :=
> pattern.compile('Section ((\\d)[(\\.\\d)]*)');
> # var pattern : new Native('java.util.regex.Pattern') :=
> Pattern.compile('Section ((\\d)[(\\.\\d)]*)');
> # var pattern : new Native('java.util.regex.Pattern') :=
> java.util.regex.Pattern.compile('Section ((\\d)[(\\.\\d)]*)');
> # var pattern : new Native('java.util.regex.Pattern');
>
> All of which result in an EXCEPTION: Internal error:
> java.lang.InstantiationException: java.util.regex.Pattern
>
> Has anyone any suggestions to try.
>
> Many thanks,
>
> Darren
>
Re: Java via Epsilon Tools [message #579520 is a reply to message #482108] Tue, 25 August 2009 12:22 Go to previous message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi Darren,

If you are using Epsilon from source, please update and then you can
simply write the following:

var pattern = Native('java.util.regex.Pattern').compile('\\d');

var matcher = pattern.matcher('Some text and 1 digit');

while (matcher.find()) {
matcher.start().println();
matcher.group().println();
matcher.end().println();
}

The change will appear in 0.8.7 - which should be released within the
next couple of days. I'll also update the EGL/Tomcat integration shortly.

Cheers,
Dimitris

Dimitris Kolovos wrote:
> Hi Darren,
>
> Since Pattern doesn't provide an accessible constructor - only the
> static "compile" method, you should create your own tool that wraps
> Pattern (using Java) and then call it from Epsilon.
>
> Having said this, calling static methods seems like a useful feature
> that should be supported natively by Epsilon. Would you mind opening an
> enhancement request in the bugzilla for this?
>
> Cheers,
> Dimitris
>
> Darren Clowes wrote:
>> Hi All,
>>
>> I'm trying to execute some regular expression searches in a
>> transformation. The Java I need to execute uses the
>> Java.utils.regex.Pattern and Java.utils.regex.Matcher. Dimtitris
>> kindly pointed me to the Epsilon Tools documentation and I can follow
>> the JFrame example. However from what I can tell there is no default
>> constructor for Pattern, which is what I believe to be causing me the
>> problems.
>>
>> Pattern is typically called in Java by:
>> Pattern p = Pattern.compile('regex Srring');
>>
>> I have tried:
>> # var pattern : new Native('java.util.regex.Pattern') :=
>> pattern.compile('Section ((\\d)[(\\.\\d)]*)');
>> # var pattern : new Native('java.util.regex.Pattern') :=
>> Pattern.compile('Section ((\\d)[(\\.\\d)]*)');
>> # var pattern : new Native('java.util.regex.Pattern') :=
>> java.util.regex.Pattern.compile('Section ((\\d)[(\\.\\d)]*)');
>> # var pattern : new Native('java.util.regex.Pattern');
>>
>> All of which result in an EXCEPTION: Internal error:
>> java.lang.InstantiationException: java.util.regex.Pattern
>>
>> Has anyone any suggestions to try.
>>
>> Many thanks,
>>
>> Darren
>>
Re: Java via Epsilon Tools [message #579537 is a reply to message #482108] Tue, 25 August 2009 12:47 Go to previous message
Darren  is currently offline Darren Friend
Messages: 40
Registered: September 2009
Member
I think I created that correctly you should find the request available at:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=287549

Darren.
Re: Java via Epsilon Tools [message #579554 is a reply to message #482121] Tue, 25 August 2009 13:12 Go to previous message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Thanks Darren. For some reason I didn't receive a notification from the
bugzilla and opened this

https://bugs.eclipse.org/bugs/show_bug.cgi?id=287548

I've marked the one as a duplicate of the other so that's fine now.

Cheers,
Dimitris

Darren Clowes wrote:
> I think I created that correctly you should find the request available at:
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=287549
>
> Darren.
>
Previous Topic:Java via Epsilon Tools
Next Topic:EGL + Tomcat? (egl.servlet)
Goto Forum:
  


Current Time: Sat Dec 20 01:48:43 GMT 2014

Powered by FUDForum. Page generated in 0.01878 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software