<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    gembin

    OSGi, Eclipse Equinox, ECF, Virgo, Gemini, Apache Felix, Karaf, Aires, Camel, Eclipse RCP

    HBase, Hadoop, ZooKeeper, Cassandra

    Flex4, AS3, Swiz framework, GraniteDS, BlazeDS etc.

    There is nothing that software can't fix. Unfortunately, there is also nothing that software can't completely fuck up. That gap is called talent.

    About Me

     

    [原創(chuàng)]Example for GraniteDS v1.2.0 OSGi bundle

    In the last two entries, i gave an rough introduction on how to add OSGi support to GraniteDS.
    After several days, i made some efforts on the GraniteDS OSGi bundle, finally i got a simple implementation (also i had contributed it to http://www.graniteds.org).
    In this entry, i would like to give a short example on HOW-TO use this GraniteDS OSGi bundle.
    the non-official GraniteDS OSGi bundle can be downloaded from org.granite.osgi_1.2.0.v200812012334_beta.zip, and also both the src and binary of the graniteds-osgi-example can be downloaded from org.granite.osgi.example_src_1.0.0.v200812100107.zip and org.granite.osgi.example_bin_1.0.0.v200812100107.zip

    Step1. download the zip files, unzip and install them in the osgi container, make sure start org.granite.osgi bundle before          org.granite.osgi.example. the granite DataService in the example bundle will be scanned and reigstered by org.granite.osgi bundle.
          

    Step2.
        
    Open a browser and access http://localhost:{port}/web/GranitedsSample.html,
       
         click button Test1, you will get Hello :)-->gembin
        
         
         
    click button Test2, you will get Just test===>gembin

           

           Now we try to stop example bundle, then dataservice will be removed by org.granite.osgi bundle

           if click button Test1,we will get an error, because the service is not available now.
           Also we will get an exception StackTrace printed in the osgi console, because
           org.granite.messaging.service.ServiceFactory.getFactoryInstance will be NULL, for this version i didn't handle this
           but it will not affact the usage.
          
          

    HOW-TO Write a Granite OSGi DataService

    1. write a service as following:

    the source code of for Test1
     1 package org.granite.osgi.example;
     2 
     3 import org.granite.messaging.service.annotations.RemoteDestination;
     4 
     5 @RemoteDestination(id = "helloService", service = "granite-service", channel = "my-graniteamf", scope = "session")
     6 public class HelloService {
     7 
     8     public String sayHello(String user) {
     9         return "Hello :)--> " + user;
    10     }
    11 
    12 }

    the source code of for Test2
    1 package org.granite.osgi.example.test;
    2 
    3 import org.granite.messaging.service.annotations.RemoteDestination;
    4 
    5 @RemoteDestination(id = "testService", source = "org.granite.osgi.example.test.TestService")
    6 public interface ITestService {
    7     public String test(String str);
    8 }
    9 

    1 package org.granite.osgi.example.test;
    2 public class TestService implements ITestService {
    3 
    4     public String test(String str) {
    5         return "Just test===>" + str;
    6     }
    7 
    8 }

    2.Export the service packages in the MANIFEST.MF
     
    Export-Package: org.granite.osgi.example,org.granite.osgi.example.test

    3.Create an XML config file for service lookup (i.e. named granite-osgi.xml under directory GraniteDS-INF, any place any name as you want)

    <graniteds>
        
    <services>
        
    <!-- any valid granite dataService in the package org.granite.osgi.example and it's subpackages will be registered-->
            
    <service packages="org.granite.osgi.example.*" />
        
    </services>
    </graniteds>


    4.Add GraniteDS Property key in the MANIFEST.MF

    GraniteDS-Service: GraniteDS-INF/granite-osgi.xml

    5.Register static resources stuff in the Activator for Flex part

    HttpContext commonContext = httpService.createDefaultHttpContext();
     
    //register the resources
     httpService.registerResources("/web", "/WebResources", commonContext);
     
     
    put all your resources under folder WebResources.

    6.Make a bundle and install it, that is.

     
    javax.xml bundle and osgi event service is required for granite-osgi bundle,
     
    for me, i use eclipse equinox as osgi container.
     


    I hope you will like to play with it.
      





    posted on 2008-12-10 02:21 gembin 閱讀(3397) 評論(7)  編輯  收藏 所屬分類: OSGiFlex

    評論

    # re: [原創(chuàng)]Example for GraniteDS v1.2.0 OSGi bundle 2008-12-20 00:26 Mehdi

    I'm trying to use your org.granite.osgi bundle on Felix OSGi, but i got the following message when i push Test buton :

    faultCode:Client.Error.MessageSend faultString:'Send failed' faultDetail:'Channel.Connect.Failed error NetConnection.Call.Failed: HTTP: Status 500: url: 'http://localhost:8080/WebContent/graniteamf/amf"
    do you have any idea to solve that??

    i would like to notice that i have this error message when i start the exemple granite bundle :

    start file:H:\Dev\Granite\org.granite.osgi.example_1.0.0.v200812100107.jar
    DEBUG: WIRE: 17.0 -> org.granite.messaging.service.annotations -> 4.2
    DEBUG: WIRE: 17.0 -> org.osgi.util.tracker -> 0
    DEBUG: WIRE: 17.0 -> org.osgi.framework -> 0
    DEBUG: WIRE: 17.0 -> org.osgi.service.http -> 8.0
    org.mortbay.log:started /WebResources
    Hello Graniteds OSGi Bundle!!
    -> 19 dÚc. 2008 17:14:59 org.granite.logging.JdkLogger info
    INFO: Processing AddService for bundle org.granite.osgi.example
    19 dÚc. 2008 17:14:59 org.granite.logging.JdkLogger info
    INFO: GraniteDS-Service:GraniteDS-INF/granite-osgi.xml
    Exception in thread "Thread-14" javax.xml.parsers.FactoryConfigurationError: Provider org.apache.xer
    ces.jaxp.DocumentBuilderFactoryImpl not found
    at javax.xml.parsers.DocumentBuilderFactory.newInstance(Unknown Source)
    at org.granite.osgi.metadata.ManifestMetadataParser.getDocumentBuilder(ManifestMetadataParse
    r.java:196)
    at org.granite.osgi.metadata.ManifestMetadataParser.parseMetadata(ManifestMetadataParser.jav
    a:164)
    at org.granite.osgi.metadata.ManifestMetadataParser.access$1(ManifestMetadataParser.java:160
    )
    at org.granite.osgi.metadata.ManifestMetadataParser$MetadataProcessor.run(ManifestMetadataPa
    rser.java:325)
    at java.lang.Thread.run(Unknown Source)


    Thank you
      回復(fù)  更多評論   

    # re: [原創(chuàng)]Example for GraniteDS v1.2.0 OSGi bundle 2008-12-21 00:57 gembin

    it seems the required bundle javax.xml_1.3.4.v200806030440.jar is not installed, so the ManifestMetadataParser cannot parse the granite-osgi.xml, which will be result in the data service not registered and also osgi EventAdmin is required(org.eclipse.equinox.event_1.1.0.v20080225.jar).. you can find it in the eclipse plugins directory.

    Note: the flex file (i.e. sample.mxml) should be compiled using the WebContent Context  回復(fù)  更多評論   

    # re: [原創(chuàng)]Example for GraniteDS v1.2.0 OSGi bundle 2009-06-09 06:57 marecage@gmail.com

    Hi  回復(fù)  更多評論   

    # re: [原創(chuàng)]Example for GraniteDS v1.2.0 OSGi bundle 2009-06-09 07:01 marecage@gmail.com

    THanks for your work,its very useful.I tried to create an osgi bundle similar to yours using eclipse but I am always getting this error:


    [javac] /home/emrah/flex_workspace2/BinaryLightDeviceBundle/src/fr/imag/adele/homega/devices/Activator.java:3: package org.osgi.framework does not exist
    [javac] import org.osgi.framework.BundleActivator;
    [javac] ^
    [javac] /home/emrah/flex_workspace2/BinaryLightDeviceBundle/src/fr/imag/adele/homega/devices/Activator.java:4: package org.osgi.framework does not exist
    [javac] import org.osgi.framework.BundleContext;
    [javac] ^
    [javac] /home/emrah/flex_workspace2/BinaryLightDeviceBundle/src/fr/imag/adele/homega/devices/Activator.java:5: package org.osgi.framework does not exist
    [javac] import org.osgi.framework.ServiceReference;
    [javac] ^
    [javac] /home/emrah/flex_workspace2/BinaryLightDeviceBundle/src/fr/imag/adele/homega/devices/Activator.java:6: package org.osgi.service.http does not exist
    [javac] import org.osgi.service.http.HttpContext;
    [javac] ^
    [javac] /home/emrah/flex_workspace2/BinaryLightDeviceBundle/src/fr/imag/adele/homega/devices/Activator.java:7: package org.osgi.service.http does not exist
    [javac] import org.osgi.service.http.HttpService;
    [javac] ^
    [javac] /home/emrah/flex_workspace2/BinaryLightDeviceBundle/src/fr/imag/adele/homega/devices/Activator.java:8: package org.osgi.util.tracker does not exist
    [javac] import org.osgi.util.tracker.ServiceTracker;
    [javac] ^
    [javac] /home/emrah/flex_workspace2/BinaryLightDeviceBundle/src/fr/imag/adele/homega/devices/Activator.java:11: cannot find symbol
    [javac] symbol: class BundleActivator
    [javac] public class Activator implements BundleActivator {
    [javac] ^
    [javac] /home/emrah/flex_workspace2/BinaryLightDeviceBundle/src/fr/imag/adele/homega/devices/Activator.java:12: cannot find symbol
    [javac] symbol : class ServiceTracker
    [javac] location: class fr.imag.adele.homega.devices.Activator
    [javac] ServiceTracker stracker;
    [javac] ^
    [javac] /home/emrah/flex_workspace2/BinaryLightDeviceBundle/src/fr/imag/adele/homega/devices/Activator.java:14: cannot find symbol
    [javac] symbol : class BundleContext
    [javac] location: class fr.imag.adele.homega.devices.Activator
    [javac] public void start(BundleContext context) throws Exception {
    [javac] ^
    [javac] /home/emrah/flex_workspace2/BinaryLightDeviceBundle/src/fr/imag/adele/homega/devices/Activator.java:47: cannot find symbol
    [javac] symbol : class BundleContext
    [javac] location: class fr.imag.adele.homega.devices.Activator
    [javac] public void stop(BundleContext context) throws Exception {
    [javac] ^
    [javac] /home/emrah/flex_workspace2/BinaryLightDeviceBundle/src/fr/imag/adele/homega/devices/Activator.java:20: cannot find symbol
    [javac] symbol : class ServiceTracker
    [javac] location: class fr.imag.adele.homega.devices.Activator
    [javac] private class HttpServiceTracker extends   回復(fù)  更多評論   

    # re: [原創(chuàng)]Example for GraniteDS v1.2.0 OSGi bundle 2009-06-09 07:01 marecage@gmail.com

    ServiceTracker {
    [javac] ^
    [javac] /home/emrah/flex_workspace2/BinaryLightDeviceBundle/src/fr/imag/adele/homega/devices/Activator.java:24: cannot find symbol
    [javac] symbol : class BundleContext
    [javac] location: class fr.imag.adele.homega.devices.Activator.HttpServiceTracker
    [javac] public HttpServiceTracker(BundleContext context) {
    [javac] ^
    [javac] /home/emrah/flex_workspace2/BinaryLightDeviceBundle/src/fr/imag/adele/homega/devices/Activator.java:28: cannot find symbol
    [javac] symbol : class ServiceReference
    [javac] location: class fr.imag.adele.homega.devices.Activator.HttpServiceTracker
    [javac] public Object addingService(ServiceReference reference) {
    [javac] ^
    [javac] /home/emrah/flex_workspace2/BinaryLightDeviceBundle/src/fr/imag/adele/homega/devices/Activator.java:40: cannot find symbol
    [javac] symbol : class ServiceReference
    [javac] location: class fr.imag.adele.homega.devices.Activator.HttpServiceTracker
    [javac] public void removedService(ServiceReference reference, Object service) {
    [javac] ^
    [javac] /home/emrah/flex_workspace2/BinaryLightDeviceBundle/src/fr/imag/adele/homega/devices/BinaryLight.java:3: package org.granite.messaging.service.annotations does not exist
    [javac] import org.granite.messaging.service.annotations.RemoteDestination;
    [javac] ^
    [javac] /home/emrah/flex_workspace2/BinaryLightDeviceBundle/src/fr/imag/adele/homega/devices/BinaryLight.java:5: cannot find symbol
    [javac] symbol: class RemoteDestination
    [javac] @RemoteDestination(id = "BinaryLightService", service = "granite-service", channel = "amfchannel", scope = "session")
    [javac] ^
    [javac] /home/emrah/flex_workspace2/BinaryLightDeviceBundle/src/fr/imag/adele/homega/devices/Activator.java:25: cannot find symbol
    [javac] symbol : class HttpService
    [javac] location: class fr.imag.adele.homega.devices.Activator.HttpServiceTracker
    [javac] super(context, HttpService.class.getName(), null);
    [javac] ^
    [javac] /home/emrah/flex_workspace2/BinaryLightDeviceBundle/src/fr/imag/adele/homega/devices/Activator.java:29: cannot find symbol
    [javac] symbol : class HttpService
    [javac] location: class fr.imag.adele.homega.devices.Activator.HttpServiceTracker
    [javac] final HttpService httpService = (HttpService) context.getService(reference);
    [javac] ^
    [javac] /home/emrah/flex_workspace2/BinaryLightDeviceBundle/src/fr/imag/adele/homega/devices/Activator.java:29: cannot find symbol
    [javac] symbol : class HttpService
    [javac] location: class fr.imag.adele.homega.devices.Activator.HttpServiceTracker
    [javac] final HttpService httpService = (HttpService) context.getService(reference);
    [javac] ^
    [javac] /home/emrah/flex_workspace2/BinaryLightDeviceBundle/src/fr/imag/adele/homega/devices/Activator.java:29: cannot find symbol
    [javac] symbol : variable context
    [javac] location: class fr.imag.adele.homega.devices.Activator.HttpServiceTracker
    [javac] final HttpService httpService = (HttpService) context.getService(reference);
    [javac] ^
    [javac] /home/emrah/flex_workspace2/BinaryLightDeviceBundle/src/fr/imag/adele/homega/devices/Activator.java:31: cannot find symbol
    [javac] symbol : class HttpContext
    [javac] location: class fr.imag.adele.homega.devices.Activator.HttpServiceTracker
    [javac] HttpContext commonContext = httpService.createDefaultHttpContext();
    [javac] ^
    [javac] /home/emrah/flex_workspace2/BinaryLightDeviceBundle/src/fr/imag/adele/homega/devices/Activator.java:41: cannot find symbol
    [javac] symbol : class HttpService
    [javac] location: class fr.imag.adele.homega.devices.Activator.HttpServiceTracker
    [javac] final HttpService httpService = (HttpService) service;
    [javac] ^
    [javac] /home/emrah/flex_workspace2/BinaryLightDeviceBundle/src/fr/imag/adele/homega/devices/Activator.java:41: cannot find symbol
    [javac] symbol : class HttpService
    [javac] location: class fr.imag.adele.homega.devices.Activator.HttpServiceTracker
    [javac] final HttpService httpService = (HttpService) service;
    [javac] ^
    [javac] 23 errors
    [javac] Compile failed; see the compiler error output for details.


    THanks in advance.  回復(fù)  更多評論   

    # re: [原創(chuàng)]Example for GraniteDS v1.2.0 OSGi bundle 2009-06-09 07:04 marecage@gmail.com

    By the way I used your ant file in eclipse to compile it.  回復(fù)  更多評論   

    # re: [原創(chuàng)]Example for GraniteDS v1.2.0 OSGi bundle 2009-06-09 21:57 gembin

    Sorry, the ant file is generated by eclipse and i didn't use it.
    Maybe there are some problems.

    Why not just use Eclipse to compile the code and export it as a bundle. it should work!  回復(fù)  更多評論   

    導(dǎo)航

    統(tǒng)計

    常用鏈接

    留言簿(6)

    隨筆分類(440)

    隨筆檔案(378)

    文章檔案(6)

    新聞檔案(1)

    相冊

    收藏夾(9)

    Adobe

    Android

    AS3

    Blog-Links

    Build

    Design Pattern

    Eclipse

    Favorite Links

    Flickr

    Game Dev

    HBase

    Identity Management

    IT resources

    JEE

    Language

    OpenID

    OSGi

    SOA

    Version Control

    最新隨筆

    搜索

    積分與排名

    最新評論

    閱讀排行榜

    評論排行榜

    free counters
    主站蜘蛛池模板: 亚洲欧洲日韩国产综合在线二区| 伊人久久大香线蕉亚洲| 免费精品久久久久久中文字幕 | 国产成+人+综合+亚洲专| 亚洲AV成人精品网站在线播放| 亚洲日韩图片专区第1页| 91亚洲性爱在线视频| 久久亚洲精品11p| 一级特黄录像免费播放肥| 91大神在线免费观看| 人人玩人人添人人澡免费| 黄页免费的网站勿入免费直接进入| 4444www免费看| 日本二区免费一片黄2019| 国产乱辈通伦影片在线播放亚洲 | 亚洲国产人成中文幕一级二级| 一个人看www在线高清免费看| 日本黄色免费观看| 精品亚洲综合在线第一区| 亚洲一级毛片免费观看| 全部一级一级毛片免费看| 免费无码又爽又刺激高潮视频| 成在人线av无码免费高潮喷水| 99久久久国产精品免费无卡顿 | 亚洲国产成人精品不卡青青草原| 国产亚洲国产bv网站在线| 久久久WWW免费人成精品| 波多野结衣中文字幕免费视频| 亚洲精品国产福利一二区| 亚洲国产日韩在线成人蜜芽| 免费人成视频在线播放| jjizz全部免费看片| 日本精品人妻无码免费大全 | 国产精品四虎在线观看免费 | 中文在线观看免费网站| 成人免费毛片内射美女APP| 亚洲精品无码永久在线观看你懂的| 亚洲一区在线观看视频| 中国一级特黄的片子免费| 在线不卡免费视频| 亚洲福利在线观看|