Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [equinox-dev] Re:Can ActiveMQ be used together with OSGI?

On 21/06/07, Wang Zhu <transitwang@xxxxxxxxx> wrote:
But I have import those things in my program:
import javax.jms.Connection;
import javax.jms.Destination;
import javax.jms.JMSException;
import javax.jms.Session;
import javax.jms.DeliveryMode;
import javax.jms.MessageProducer;
import javax.jms.TextMessage;
import org.apache.activemq.ActiveMQConnection;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.util.IndentPrinter;

There is a difference between imports at the Java language level, and imports between OSGi bundles.
 
For example, I may have a private internal class that uses another class - in this case I may need to
import it using a normal Java import (such as import com.example.MyClassImpl). But if both classes
are internal to the OSGi bundle then I don't need to mention them, or their packages, in the import or
export package instructions.

Think of Import-Package and Export-Package as describing wires between OSGi bundles - internally
your code will use Java-level imports, but as a bundle it needs to describe what classes it can share
with other bundles and what classes it needs from other bundles (or the framework).

If your bundle doesn't contain the javax.jms.* classes then they either need to come from the system
classpath, or another bundle.

    ( ps. you might want to look at the Bnd tool, which can produce OSGi metadata
      for you just by analyzing your classfiles - see http://www.aqute.biz/Code/Bnd )

hope this makes things a bit clearer...

Regards,
--
TransitWang/WangZhu
Computer School,Northwestern Polytechnical University

_______________________________________________
equinox-dev mailing list
equinox-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/equinox-dev




--
Cheers, Stuart

Back to the top