06-15-2005, 01:15 PM
|
#593
|
Cooling Savant
Join Date: Aug 2004
Location: UK
Posts: 909
|
Thanks. For the record, what 2200 h/w and bios do you use?
You will need to create an altered manifest file and there is also something to create a snap server class
Try dissasembling the provided java apps
From Rami:
Quote:
Anyway I worked out how java apps work on the snap server by examining the example provided. BTW java apps running on the snap server are commonly known as snaplets - I didn't make this up.
After you have installed java onto your snap server, check out the share called os_private. It is usually hidden and has restricted access rights. You can of course change those in the snap server access pages, I am sure you know how it works.
Snaplets are stored in the path:
\os_private\Java\Jeode\snapserver\snaplets\jars
There should be a Hello.jar located there. That is the example app I was talking about above. The source code to Hello.jar is located here:
\os_private\Java\Jeode\classes
(ignore the files in the 'demo' directory, the files that went into Hello.jar are in the 'hello' subdirectory, ie
\os_private\Java\Jeode\classes\com\snapserver\demo \hello)
Snaplets are made up of two components, a UI and a server. The server runs on the snap, and the UI component is the piece that you see in the SnapExtentions link on the configuration page.
The UI is simply a standard Applet. It uses RMI to communicate to the server component. You can check the file (HelloUI.class) to see how that is done.
The Server side is the more interesting piece.
The server class must implement the 'Snaplet' interface. This class is defined in the jar file:
\os_private\Java\snapex.jar
Copy the jar file and add it to your development area class path, or if you are using Eclipse as your environment, then just add it as an external jar.
The interface defines 2 methods (stop() and isRunning()) of it's own, plus as it also implements Runnable, you must also implement the run() method.
For my apps, I read a config file in the constructor for the main class. When run() gets called, I start the app, and set a flag that I am running. Then when stop() is called, I stop my app, and clear the flag. When isRunning() is called, I just return the flag status.
Remember that the server side can not have any UI, and to debug, you can write information to System.out.xxxx methods. The output will appear in the snap server log file.
Putting it all together into a jar file. If you check the manifest file in the Hello.jar, you will see that there are some extra pieces, ie:
Name: SnapletConfig
Snaplet-AppletClassName: com.snapserver.demo.hello.HelloUI
Snaplet-Description: Hello World of SnapExtension
Snaplet-MainClass: com.snapserver.demo.hello.HelloService
Snaplet-License: N
*Name is self explanitory.
*Snaplet-AppletClassName is the class name of the UI component of the snaplet.
*Snaplet-Description is the description text that you see in the SnapExtentions web page, mentioned above.
*Snaplet-MainClass is the class that implements the server component of the snaplet, ie implements the Snaplet interface.
*Snaplet-License is self explanitory.
There is also one other I have found,
Snaplet-IconFile: file.gif
This is the image that is placed next to the title and description on the SnapExtentions page.
Also, in the jar file you will see a .ser file. This is some sort of serial number. To generate this file, you need to execute the java class:
com.snapserver.ext.SnapletIDWriter
This class exists within the snapex.jar file.
Run the class, provide the name of your server class, and bang, it generates a .ser file.
|
Hope that helps
Thanks
Sam
|
|
|