You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Oliver Günther <ol...@gg-net.de> on 2011/11/09 12:21:27 UTC

OpenEJB Embeeded Progress Monitor

Hi,

just wanted to know if there is a simple way to get progress infromation 
of an embedded OpenEJB instance.
I'm looking for a way to get Information for an JProgressBar.
Right now i could only print out the logging output of OpenEJB, which is 
ok .... but not nice :-D

Thanks,
Olli


Re: OpenEJB Embeeded Progress Monitor

Posted by og0815 <ol...@gg-net.de>.
Hi,

code looks like this.

import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.SplashScreen;
import org.apache.log4j.AppenderSkeleton;
import org.apache.log4j.spi.LoggingEvent;

public class SplashAppender extends AppenderSkeleton {

    private String s1 = "Loading ";

    private String s2 = "";

    private String s3 = "";

    private SplashScreen splash;

    private Graphics2D graphics;

    // On every call adds a point to the graphics instance
    private void renderSplashFrame() {
        int size = 35;
        if ( s1.length() > size && s2.length() > size && s3.length() > size
); 
        else if ( s1.length() > size && s2.length() > size ) s3 += ".";
        else if ( s1.length() > size ) s2 += ".";
        else s1 += ".";
        graphics.drawString(s1, 5, 15);
        graphics.drawString(s2, 5, 30);
        graphics.drawString(s3, 5, 45);
        splash.update();
    }

    @Override
    protected void append(LoggingEvent event) {
        if ( getThreshold() != null && getThreshold().toInt() >
event.getLevel().toInt() ) return;
        if ( splash == null ) {
            splash = SplashScreen.getSplashScreen();
            if ( splash == null ) return;
        }
        if ( !splash.isVisible() ) return;
        if ( graphics == null ) {
            graphics = splash.createGraphics();
            if ( graphics == null ) return;
            graphics.setComposite(AlphaComposite.Clear);
            graphics.fillRect(0, 0, 100, 100);
            graphics.setPaintMode();
            graphics.setColor(Color.WHITE);
            graphics.setFont(new Font(Font.MONOSPACED, Font.BOLD, 12));
        }
        renderSplashFrame();
    }

    @Override
    public void close() {
        // nothing to do;
    }

    @Override
    public boolean requiresLayout() {
        return false;
    }
}


--
View this message in context: http://openejb.979440.n4.nabble.com/OpenEJB-Embeeded-Progress-Monitor-tp4019519p4082625.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: OpenEJB Embeeded Progress Monitor

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi,

Dont hesitate to share your code if possible, it can be useful for others
;).

- Romain

Le 16 nov. 2011 19:18, "og0815" <ol...@gg-net.de> a écrit :

> Hi,
>
> thanks for all your input. I solved it with a log4j appender. It will do
> for
> now. Puts nice points on a splash screen.
>
> Regard,
> Olli
>
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/OpenEJB-Embeeded-Progress-Monitor-tp4019519p4077329.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Re: OpenEJB Embeeded Progress Monitor

Posted by og0815 <ol...@gg-net.de>.
Hi, 

thanks for all your input. I solved it with a log4j appender. It will do for
now. Puts nice points on a splash screen. 

Regard,
Olli




--
View this message in context: http://openejb.979440.n4.nabble.com/OpenEJB-Embeeded-Progress-Monitor-tp4019519p4077329.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: OpenEJB Embeeded Progress Monitor

Posted by Romain Manni-Bucau <rm...@gmail.com>.
IMHO, in our current version we dont log/notify enough info.

- Romain

Le 9 nov. 2011 23:07, "Mohammad Nour El-Din" <no...@gmail.com> a
écrit :

> On Wed, Nov 9, 2011 at 9:42 PM, Romain Manni-Bucau <rmannibucau@gmail.com
> >wrote:
>
> > yep a custom log4j appender is probably enough to follow logs.
> >
> > but with version 1 we should add event/logs to be complete.
> >
>
> Sorry didn't get that part :) ?
>
>
> >
> > - Romain
> >
> >
> > 2011/11/9 Mohammad Nour El-Din <no...@gmail.com>
> >
> > > I believe having a log handler would one solution and also it would be
> > > configurable, this log handler can send these events to whatever
> > > destination which developers can use as a more easier a nicer way than
> > > parsing log messages.
> > >
> > > Thoughts ?
> > >
> > > On Wed, Nov 9, 2011 at 8:48 PM, Romain Manni-Bucau <
> > rmannibucau@gmail.com
> > > >wrote:
> > >
> > > > i understand we can to add event but for this problem i wonder if
> they
> > > will
> > > > be relevant
> > > >
> > > > but we can generalize the question for sure!
> > > >
> > > > - Romain
> > > >
> > > >
> > > > 2011/11/9 David Blevins <da...@gmail.com>
> > > >
> > > > >
> > > > > On Nov 9, 2011, at 9:06 AM, Romain Manni-Bucau wrote:
> > > > >
> > > > > > yep i understand,
> > > > > >
> > > > > > however it is hard to know before starting how many beans are "to
> > > > > deploy".
> > > > > >
> > > > > > we could do something like: send an event when we know
> everything,
> > > > send a
> > > > > > event by bean...but i think it will have performance issues and
> i'm
> > > not
> > > > > > sure it is exactly what you want since the first phase will
> > probably
> > > be
> > > > > as
> > > > > > longer as the second.
> > > > >
> > > > > CDI events come to mind.  There are a few places in our code I was
> > > > > thinking CDI events might be nice.  The multicast/multipoint "node
> > > added"
> > > > > and "node removed" events were rolling around my brain last week.
> > > > >
> > > > > How to pull that off isn't exactly clear, but it's certainly an
> > > > > interesting itch to scratch.
> > > > >
> > > > > -David
> > > > >
> > > > >
> > > >
> > >
> > >
> > >
> > > --
> > > Thanks
> > > - Mohammad Nour
> > > ----
> > > "Life is like riding a bicycle. To keep your balance you must keep
> > moving"
> > > - Albert Einstein
> > >
> >
>
>
>
> --
> Thanks
> - Mohammad Nour
> ----
> "Life is like riding a bicycle. To keep your balance you must keep moving"
> - Albert Einstein
>

Re: OpenEJB Embeeded Progress Monitor

Posted by Mohammad Nour El-Din <no...@gmail.com>.
On Wed, Nov 9, 2011 at 9:42 PM, Romain Manni-Bucau <rm...@gmail.com>wrote:

> yep a custom log4j appender is probably enough to follow logs.
>
> but with version 1 we should add event/logs to be complete.
>

Sorry didn't get that part :) ?


>
> - Romain
>
>
> 2011/11/9 Mohammad Nour El-Din <no...@gmail.com>
>
> > I believe having a log handler would one solution and also it would be
> > configurable, this log handler can send these events to whatever
> > destination which developers can use as a more easier a nicer way than
> > parsing log messages.
> >
> > Thoughts ?
> >
> > On Wed, Nov 9, 2011 at 8:48 PM, Romain Manni-Bucau <
> rmannibucau@gmail.com
> > >wrote:
> >
> > > i understand we can to add event but for this problem i wonder if they
> > will
> > > be relevant
> > >
> > > but we can generalize the question for sure!
> > >
> > > - Romain
> > >
> > >
> > > 2011/11/9 David Blevins <da...@gmail.com>
> > >
> > > >
> > > > On Nov 9, 2011, at 9:06 AM, Romain Manni-Bucau wrote:
> > > >
> > > > > yep i understand,
> > > > >
> > > > > however it is hard to know before starting how many beans are "to
> > > > deploy".
> > > > >
> > > > > we could do something like: send an event when we know everything,
> > > send a
> > > > > event by bean...but i think it will have performance issues and i'm
> > not
> > > > > sure it is exactly what you want since the first phase will
> probably
> > be
> > > > as
> > > > > longer as the second.
> > > >
> > > > CDI events come to mind.  There are a few places in our code I was
> > > > thinking CDI events might be nice.  The multicast/multipoint "node
> > added"
> > > > and "node removed" events were rolling around my brain last week.
> > > >
> > > > How to pull that off isn't exactly clear, but it's certainly an
> > > > interesting itch to scratch.
> > > >
> > > > -David
> > > >
> > > >
> > >
> >
> >
> >
> > --
> > Thanks
> > - Mohammad Nour
> > ----
> > "Life is like riding a bicycle. To keep your balance you must keep
> moving"
> > - Albert Einstein
> >
>



-- 
Thanks
- Mohammad Nour
----
"Life is like riding a bicycle. To keep your balance you must keep moving"
- Albert Einstein

Re: OpenEJB Embeeded Progress Monitor

Posted by Romain Manni-Bucau <rm...@gmail.com>.
yep a custom log4j appender is probably enough to follow logs.

but with version 1 we should add event/logs to be complete.

- Romain


2011/11/9 Mohammad Nour El-Din <no...@gmail.com>

> I believe having a log handler would one solution and also it would be
> configurable, this log handler can send these events to whatever
> destination which developers can use as a more easier a nicer way than
> parsing log messages.
>
> Thoughts ?
>
> On Wed, Nov 9, 2011 at 8:48 PM, Romain Manni-Bucau <rmannibucau@gmail.com
> >wrote:
>
> > i understand we can to add event but for this problem i wonder if they
> will
> > be relevant
> >
> > but we can generalize the question for sure!
> >
> > - Romain
> >
> >
> > 2011/11/9 David Blevins <da...@gmail.com>
> >
> > >
> > > On Nov 9, 2011, at 9:06 AM, Romain Manni-Bucau wrote:
> > >
> > > > yep i understand,
> > > >
> > > > however it is hard to know before starting how many beans are "to
> > > deploy".
> > > >
> > > > we could do something like: send an event when we know everything,
> > send a
> > > > event by bean...but i think it will have performance issues and i'm
> not
> > > > sure it is exactly what you want since the first phase will probably
> be
> > > as
> > > > longer as the second.
> > >
> > > CDI events come to mind.  There are a few places in our code I was
> > > thinking CDI events might be nice.  The multicast/multipoint "node
> added"
> > > and "node removed" events were rolling around my brain last week.
> > >
> > > How to pull that off isn't exactly clear, but it's certainly an
> > > interesting itch to scratch.
> > >
> > > -David
> > >
> > >
> >
>
>
>
> --
> Thanks
> - Mohammad Nour
> ----
> "Life is like riding a bicycle. To keep your balance you must keep moving"
> - Albert Einstein
>

Re: OpenEJB Embeeded Progress Monitor

Posted by Mohammad Nour El-Din <no...@gmail.com>.
I believe having a log handler would one solution and also it would be
configurable, this log handler can send these events to whatever
destination which developers can use as a more easier a nicer way than
parsing log messages.

Thoughts ?

On Wed, Nov 9, 2011 at 8:48 PM, Romain Manni-Bucau <rm...@gmail.com>wrote:

> i understand we can to add event but for this problem i wonder if they will
> be relevant
>
> but we can generalize the question for sure!
>
> - Romain
>
>
> 2011/11/9 David Blevins <da...@gmail.com>
>
> >
> > On Nov 9, 2011, at 9:06 AM, Romain Manni-Bucau wrote:
> >
> > > yep i understand,
> > >
> > > however it is hard to know before starting how many beans are "to
> > deploy".
> > >
> > > we could do something like: send an event when we know everything,
> send a
> > > event by bean...but i think it will have performance issues and i'm not
> > > sure it is exactly what you want since the first phase will probably be
> > as
> > > longer as the second.
> >
> > CDI events come to mind.  There are a few places in our code I was
> > thinking CDI events might be nice.  The multicast/multipoint "node added"
> > and "node removed" events were rolling around my brain last week.
> >
> > How to pull that off isn't exactly clear, but it's certainly an
> > interesting itch to scratch.
> >
> > -David
> >
> >
>



-- 
Thanks
- Mohammad Nour
----
"Life is like riding a bicycle. To keep your balance you must keep moving"
- Albert Einstein

Re: OpenEJB Embeeded Progress Monitor

Posted by Romain Manni-Bucau <rm...@gmail.com>.
i understand we can to add event but for this problem i wonder if they will
be relevant

but we can generalize the question for sure!

- Romain


2011/11/9 David Blevins <da...@gmail.com>

>
> On Nov 9, 2011, at 9:06 AM, Romain Manni-Bucau wrote:
>
> > yep i understand,
> >
> > however it is hard to know before starting how many beans are "to
> deploy".
> >
> > we could do something like: send an event when we know everything, send a
> > event by bean...but i think it will have performance issues and i'm not
> > sure it is exactly what you want since the first phase will probably be
> as
> > longer as the second.
>
> CDI events come to mind.  There are a few places in our code I was
> thinking CDI events might be nice.  The multicast/multipoint "node added"
> and "node removed" events were rolling around my brain last week.
>
> How to pull that off isn't exactly clear, but it's certainly an
> interesting itch to scratch.
>
> -David
>
>

Re: OpenEJB Embeeded Progress Monitor

Posted by David Blevins <da...@gmail.com>.
On Nov 9, 2011, at 9:06 AM, Romain Manni-Bucau wrote:

> yep i understand,
> 
> however it is hard to know before starting how many beans are "to deploy".
> 
> we could do something like: send an event when we know everything, send a
> event by bean...but i think it will have performance issues and i'm not
> sure it is exactly what you want since the first phase will probably be as
> longer as the second.

CDI events come to mind.  There are a few places in our code I was thinking CDI events might be nice.  The multicast/multipoint "node added" and "node removed" events were rolling around my brain last week.

How to pull that off isn't exactly clear, but it's certainly an interesting itch to scratch.

-David


Re: OpenEJB Embeeded Progress Monitor

Posted by Romain Manni-Bucau <rm...@gmail.com>.
yep i understand,

however it is hard to know before starting how many beans are "to deploy".

we could do something like: send an event when we know everything, send a
event by bean...but i think it will have performance issues and i'm not
sure it is exactly what you want since the first phase will probably be as
longer as the second.

- Romain


2011/11/9 og0815 <ol...@gg-net.de>

> Usage Scenario:
> Before starting the Userinterface show the progress of the Application
> loading (inc. OpenEJB)
> I'll stick to the logs. Was only a nice to have feature.
>
> Thx,
> Olli
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/OpenEJB-Embeeded-Progress-Monitor-tp4019519p4020358.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Re: OpenEJB Embeeded Progress Monitor

Posted by og0815 <ol...@gg-net.de>.
Usage Scenario: 
Before starting the Userinterface show the progress of the Application
loading (inc. OpenEJB)
I'll stick to the logs. Was only a nice to have feature.

Thx,
Olli


--
View this message in context: http://openejb.979440.n4.nabble.com/OpenEJB-Embeeded-Progress-Monitor-tp4019519p4020358.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: OpenEJB Embeeded Progress Monitor

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi,

can you give more informations about the usage please? just the startup?

if yes i think the easier way is to parse logs (redirecting them in a
bytebuffer for instance).

another to try (but i think it is not exactly what you want) is to
implement an openejb service to get deployements information. I have no
ready to use example (:s)) but you can have a look to
https://svn.apache.org/repos/asf/openejb/trunk/openejb/server/openejb-rest/src/main/java/org/apache/openejb/server/rest/RESTService.java
(and
ignore rest stuff).

- Romain


2011/11/9 Oliver Günther <ol...@gg-net.de>

> Hi,
>
> just wanted to know if there is a simple way to get progress infromation
> of an embedded OpenEJB instance.
> I'm looking for a way to get Information for an JProgressBar.
> Right now i could only print out the logging output of OpenEJB, which is
> ok .... but not nice :-D
>
> Thanks,
> Olli
>
>