filedir
Class FileDirectory

java.lang.Object
  extended byfiledir.FileDirectory
All Implemented Interfaces:
common.Directory, java.util.EventListener, java.rmi.Remote, net.jini.lookup.ServiceIDListener

public class FileDirectory
extends java.lang.Object
implements common.Directory, net.jini.lookup.ServiceIDListener

Create and publish a set of services, as specified in a configuration file. A typical file is

  
import net.jini.jeri.BasicILFactory;
import net.jini.jeri.BasicJeriExporter;
import net.jini.jeri.tcp.TcpServerEndpoint;

import java.net.URL;
import net.jini.core.entry.Entry;
import net.jini.lookup.entry.*;
import com.sun.jini.config.ConfigUtil;
import java.io.File;

HttpFileSourceServer {
    exporter = new BasicJeriExporter(TcpServerEndpoint.getInstance(0),
                                     new BasicILFactory()); 

    serviceIDFile = new File("soundfiles/clapton.ids");

    cdIndexDiscID = "H2WKL5utOWh9nlMK6S3y537vygQ-";
    cddbDiscID = "cb0e7b0e";

    localhost = ConfigUtil.getHostName();
    urlBase = ConfigUtil.concat(new String[] {
                                        "http://",
                                        localhost,
                                        "/soundfiles/clapton/"
                                    }
                               );
    trackURLs = new URL[] {
                        new URL(ConfigUtil.concat(new String[] {
                                                        urlBase,
                                                        "audio_01.ogg"
                                                      }
                                                 )
                                ),
                        new URL(ConfigUtil.concat(new String[] {
                                                        urlBase,
                                                        "audio_02.ogg"
                                                      }
                                                 )
                                ),
                        new URL(ConfigUtil.concat(new String[] {
                                                        urlBase,
                                                        "audio_03.ogg"
                                                      }
                                                 )
                                ),
                        new URL(ConfigUtil.concat(new String[] {
                                                        urlBase,
                                                        "audio_04.ogg"
                                                      }
                                                 )
                                )

                };
        entries = new Entry[] {new Name("Eric Clapton / Unplugged")
                          };
        trackNames = new String[] {

                        "Signe",
                        "Before You Accuse Me",
                        "Hey Hey",
                        "Tears In Heaven"
                };
}


Field Summary
protected  http.HttpSourceImpl impl
           
protected  java.rmi.Remote proxy
           
 
Constructor Summary
FileDirectory(java.lang.String configFile, net.jini.lease.LeaseRenewalManager leaseRenewalManager)
          Uses the configuration files in the directory to produce a list of services.
 
Method Summary
 java.lang.String getCDInfo()
           
 net.jini.core.lookup.ServiceID[] getServiceIDs()
           
 java.lang.String getTrackInfo(int index)
           
static void main(java.lang.String[] argv)
           
 void serviceIDNotify(net.jini.core.lookup.ServiceID serviceID)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

proxy

protected java.rmi.Remote proxy

impl

protected http.HttpSourceImpl impl
Constructor Detail

FileDirectory

public FileDirectory(java.lang.String configFile,
                     net.jini.lease.LeaseRenewalManager leaseRenewalManager)
Uses the configuration files in the directory to produce a list of services. Each file should contain a url and entries
     
     url = new URL("http://jannote.jan.home/soundfiles/raycharles/audio_01.wav");
     entries = new Entry[] {new Name("Ray Charles track 01")
 
The natural order of files in the directory produces the ordering of urls and of services

Method Detail

getServiceIDs

public net.jini.core.lookup.ServiceID[] getServiceIDs()
                                               throws java.rmi.RemoteException
Specified by:
getServiceIDs in interface common.Directory
Throws:
java.rmi.RemoteException

serviceIDNotify

public void serviceIDNotify(net.jini.core.lookup.ServiceID serviceID)
Specified by:
serviceIDNotify in interface net.jini.lookup.ServiceIDListener

getTrackInfo

public java.lang.String getTrackInfo(int index)

getCDInfo

public java.lang.String getCDInfo()

main

public static void main(java.lang.String[] argv)