Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

net.jxta.ext.config
Class Profile  view Profile download Profile.java

java.lang.Object
  extended bynet.jxta.ext.config.Profile

public class Profile
extends java.lang.Object

A JXTA configurator that can parse an XML resource and in turn construct the relevant PlatformConfig.

All addresses are of the form URI. Addresses that do not specify a scheme will be defaulted accordingly. Further, RendezVous and Relay addresses that do not specify a host wil be replaced with the corresponding boostrap results. If a scheme is specified only bootstrap results with matching schemes will be retained. All other addresses that do not specify a host will, in turn, be replaced with the local host. All fields have backing defaults enabling one to seed a configuration with a partial yet valid resource file.

An example ResourceConfigurator"profile" is as follows:

 <?xml version="1.0" encoding="utf-8" standalone="no"?>

 <!--
 <!DOCTYPE xsd:schema SYSTEM "http://www.w3c.org/2001/XMLSchema.dtd">
 -->

 <xsd:schema xmlns:jxta="http://www.jxta.org/net/jxta/ext/config"
   xmlns:xsd="http://www.w3c.org/2001/XMLSchema.dtd">

   <xsd:annotation>
     <xsd:documentation xml:lang="en">
     JXTA Configuration

     see http://www.jxta.org for more info.
     </xsd:documentation>
   </xsd:annotation>

   <xsd:complexType name="jxta">
     <xsd:sequence>
       <xsd:element name="peer" type="jxta:Peer" minOccurs="1" maxOccurs="1"/>
       <xsd:element name="network" type="jxta:Network" minOccurs="1"
         maxOccurs="1"/>
       <xsd:element name="transport" type="jxta:Transport" minOccurs="1"
         maxOccurs="1"/>
       <xsd:element name="service" type="jxta:Service" minOccurs="1"
         maxOccurs="1"/>
     </xsd:sequence>
   </xsd:complexType>

   <xsd:complexType name="Peer">
     <xsd:attribute name="name" type="xsd:string" use="optional"/>
     <xsd:attribute name="id" type="jxta:PeerID" use="optional"/>
     <xsd:attribute name="descriptor" type="xsd:string" use="optional"/>
     <xsd:attribute name="home" type="xsd:anyURI" use="optional"
       default="file://${user.home}/.jxta"/>
     <xsd:attribute name="trace" type="jxta:Trace" use="optional"
       default="user default"/>
     <xsd:sequence>
       <xsd:element name="description" type="jxta:Description" minOccurs="0"
         maxOccurs="unbounded"/>
       <xsd:element name="security" type="jxta:Security" minOccurs="0"
         maxOccurs="1"/>
       <xsd:element name="rootCert" type="jxta:RootCert" minOccurs="0"
         maxOccurs="1"/>
       <xsd:element name="proxy" type="jxta:ProxyAddress" minOccurs="0"
         maxOccurs="1"/>
     </xsd:sequence>
   </xsd:complexType>

   <xsd:complexType name="Network">
     <xsd:sequence>
       <xsd:element name="rendezVous" type="jxta:RendezVous" minOccurs="0"
         maxOccurs="1"/>
       <xsd:element name="relays" type="jxta:Relays" minOccurs="0" maxOccurs="1"/>
     </xsd:sequence>
   </xsd:complexType>

   <xsd:complexType name="Transport">
     <xsd:sequence>
       <xsd:element name="tcp" type="Tcp" minOccurs="0" maxOccurs="unbounded"/>
       <xsd:element name="http" type="Http" minOccurs="0" maxOccurs="unbounded"/>
     </xsd:sequence>
   </xsd:complexType>

   <xsd:complexType name="Service">
     <xsd:sequence>
       <xsd:element name="rendezVous" type="jxta:RendezVousService" minOccurs="0"
         maxOccurs="1"/>
       <xsd:element name="relay" type="jxta:RelayService" minOccurs="0"
         maxOccurs="1"/>
       <xsd:element name="endpoint" type="jxta:EndpointService" minOccurs="0"
         maxOccurs="1"/>
       <xsd:element name="proxy" type="jxta:ProxyService" minOccurs="0"
         maxOccurs="1"/>
     </xsd:sequence>
   <xsd:complextType name="Configuration">
     <xsd:sequence>
       <xsd:element name="optimizer" type="jxta:Optimizer" minOccurs="0"
         maxOccurs="unbounded"/>
     </xsd:sequence>
   </xsd:complexType>

   <xsd:complextType name="Configuration">
     <xsd:sequence>
       <xsd:element name="optimizer" type="jxta:Optimizer" minOccurs="0"
         maxOccurs="unbounded"/>
     </xsd:sequence>
   </xsd:complexType>

   </xsd:complexType>

   <xsd:complextType name="Configuration">
     <xsd:sequence>
       <xsd:element name="optimizer" type="jxta:Optimizer" minOccurs="0"
         maxOccurs="unbounded"/>
     </xsd:sequence>
   </xsd:complexType>

   <xsd:simpleType name="Trace">
     <xsd:restriction base="xsd:string">
       <xsd:enumeration value="error"/>
       <xsd:enumeration value="warn"/>
       <xsd:enumeration value="info"/>
       <xsd:enumeration value="debug"/>
       <xsd:enumeration value="user default"/>
     </xsd:restriction>
   </xsd:simpleType>

   <xsd:complextType name="Description">
     <xsd:all>
     </xsd:all>
   </xsd:complextType>

   <xsd:complexType name="Security">
     <xsd:attribute name="enabled" type="xsd:boolean" use="optional"
       default="true"/>
     <xsd:attribute name="principal" type="xsd:string" use="required"/>
   </xsd:complexType>

   <xsd:complexType name="RootCert">
     <xsd:simpleContext>
       <xsd:extension base="xsd:string">
         <xsd:attribute name="address" type="xsd:anyURI" use="optional"/>
       </xsd:extension>
     </xsd:simpleContext>
   </xsd:complexType>

   <xsd:complexType name="ProxyAddress">
     <xsd:simpleContent>
       <xsd:extension base="xsd:anyURI">
         <xsd:attribute name="enabled" type="xsd:boolean" use="optional"
           default="false"/>
       </xsd:extension>
     </xsd:simpleContent>
   </xsd:complexType>

   <xsd:complexType name="RendezVous">
     <xsd:attribute name="bootstrap" type="xsd:anyURI" use="optional"/>
     <xsd:attribute name="discovery" type="xsd:boolean" use="optional"
       default="true"/>
     <xsd:element name="address" type="jxta:Address" minOccurs="0"
       maxOccurs="unbounded" default="://"/>
   </xsd:complexType>

   <xsd:complexType name="Relays">
     <xsd:attribute name="bootstrap" type="xsd:anyURI" use="optional"/>
     <xsd:attribute name="discovery" type="xsd:boolean" use="optional"
       default="true"/>
     <xsd:element name="address" type="jxta:Address" minOccurs="0"
       maxOccurs="unbounded" default="//:"/>
   </xsd:complexType>

   <xsd:element name="Address" type="xsd:anyURI"/>

   <xsd:complexType name="Tcp">
     <xsd:attribute name="enabled" type="xsd:boolean" use="optional"
       default="true"/>
     <xsd:sequence>
       <xsd:element name="incoming" type="jxta:TransportEndpoint" minOccurs="0"
         maxOccurs="1"/>
       <xsd:element name="outgoing" type="jxta:TransportEndpoint" minOccurs="0"
         maxOccurs="1"/>
       <xsd:element name="TcpAddress" type="TcpAddress" minOccurs="0"
         maxOccurs="unbounded"/>
       <xsd:element name="publicAddress" type="jxta:PublicAddress" minOccurs="0"
         maxOccurs="unbounded" default="http://:"/>
       <xsd:element name="proxy" type="jxta:ProxyAddress" minOccurs="0"
         maxOccurs="1"/>
     </xsd:sequence>
   </xsd:complexType>

   <xsd:complexType name="Http">
     <xsd:attribute name="enabled" type="xsd:boolean" use="optional"
       default="true"/>
     <xsd:sequence>
       <xsd:element name="incoming" type="jxta:TransportEndpoint" minOccurs="0"
         maxOccurs="1"/>
       <xsd:element name="outgoing" type="jxta:TransportEndpoint" minOccurs="0"
         maxOccurs="1"/>
       <xsd:element name="address" type="jxta:TransportAddress" minOccurs="0"
         maxOccurs="unbounded" default="http://:"/>
       <xsd:element name="publicAddress" type="jxta:PublicAddress" minOccurs="0"
         maxOccurs="unbounded" default="http://:"/>
       <xsd:element name="proxy" type="jxta:ProxyAddress" minOccurs="0"
         maxOccurs="1"/>
     </xsd:sequence>
   </xsd:complexType>

   <xsd:complexType name="TransportEndpoint">
     <xsd:attribute name="enabled" type="xsd:boolean" use="optional"
       default="false"/>
   </xsd:complexType>

   <xsd:complexType name="TcpAddress">
       <xsd:simpleContent>
       <xsd:extension bae="xsd:anyURI">
         <xsd:attribute name="range" type="xsd:integer">
           <xsd:restrictive>
             <xsd:minInclusive value="0"/>
             <xsd:maxInclusive value="65535"/>
           </xsd:restrictive>
         </xsd:attribute>
         <xsd:sequence>
           <xsd:element name="multicast" type="jxta:MulticastAddress"
             minOccurs="0" maxOccurs="unbounded"/>
         </xsd:sequence>
       </xsd:extension>
     </xsd:simpleContent>
   </xsd:complexType>

   <xsd:complexType name="TransportAddress">
     <xsd:simpleContent>
       <xsd:extension base="xsd:anyURI">
         <xsd:attribute name="range" type="xsd:integer">
           <xsd:restrictive>
             <xsd:minInclusive value="0"/>
             <xsd:maxInclusive value="65535"/>
           </xsd:restrictive>
         </xsd:attribute>
       </xsd:extension>
     </xsd:simpleContent>
   </xsd:complexType>

   <xsd:complextType name="MulticastAddress">
     <xsd:simpleContent>
       <xsd:extension base="xsd:anyURI">
         <xsd:attribute name="enabled" type="xsd:boolean" use="optional"
           default="true"/>
         <xsd:attribute name="size" type="xsd:nonNegativeInteger" use="optional"
           default="16384"/>
         </xsd:extension>
       </xsd:simpleContent>
   </xsd:complextType>

   <xsd:complexType name="PublicAddress">
     <xsd:attribute name="exclusive" type="xsd:boolean" use="optional"
       default="false"/>
   </xsd:complexType>

   <xsd:complexType name="RendezVousService">
     <xsd:attribute name="enabled" type="xsd:boolean" use="optional"
       default="false"/>
     <xsd:sequence>
       <xsd:element name="autoStart" type="jxta:AutoStart" minOccurs="0"
         maxOccurs="1" default="0"/>
     </xsd:sequence>
   </xsd:complexType>

   <xsd:complexType name="RelayService">
     <xsd:attribute name="enabled" type="xsd:boolean" use="optional"
       default="false"/>
     <xsd:attribute name="queueSize" type="xsd:nonNegativeInterger"
       use="optional" default="100"/>
     <xsd:sequence>
       <xsd:element name="incoming" type="jxta:ServiceEndpoint" minOccurs="0"
         maxOccurs="1"/>
       <xsd:element name="outgoing" type="jxta:ServiceEndpoint" minOccurs="0"
         maxOccurs="1"/>
     </xsd:sequence>
   </xsd:complexType>

   <xsd:complexType name="EndpointService">
     <xsd:attribute name="queueSize" type="xsd:positiveInteger" use="optional"
       default="20"/>
   </xsd:complexType>

   <xsd:complexType name="ProxyService">
     <xsd:simpleContent>
       <xsd:extension base="xsd:anyURI">
        <xsd:attribute name="enabled" type="xsd:boolean" use="optional"
          default="false"/>
       </xsd:extension>
     </xsd:simpleContent>
   </xsd:complexType>

   <xsd:element name="AutoStart">
     <xsd:simpleContent>
       <xsd:extension base="nonNegativeInteger">
         <xsd:attribute name="enabled" type="xsd:boolean" use="optional"
           default="false"/>

   <xsd:complexType name="Optimzer">
     <xsd:attribute name="class" type="xsd:string" use="required"/>
     <xsd:sequence>
        <xsd:element name="property" type="jxta:Property" minOccurs="0"
          maxOccurs="unbounded"/>
     </xsd:complexType>
   </xsd:complexType>

   <xsd:complexType name="Property">
     <xsd:simpleContent>
       <xsd:extension base="xsd:string">
         <xsd:attribute name="name" type="xsd:string" use="required"/>
       </xsd:extension>
     </xsd:simpleContent>
   </xsd:complexType>

       </xsd:extension>
     </xsd:simpleContent>
   </xsd:element>

   <xsd:complexType name="ServiceEndpoint">
     <xsd:attribute name="enabled" type="xsd:boolean" use="optional"
       default="false"/>
     <xsd:attribute name="maximum" type="xsd:positiveInteger" use="optional"
       default="1"/>
     <xsd:attribute name="lease" type="xsd:positiveInteger" use="optional"
       default="7200000"/>
   </xsd:complexType>

   <xsd:complexType name="Optimizer">
     <xsd:attribute name="class" type="xsd:string" use="required"/>
     <xsd:sequence>
        <xsd:element name="property" type="jxta:Property" minOccurs="0"
          maxOccurs="unbounded"/>
     </xsd:complexType>
   </xsd:complexType>

   <xsd:complexType name="Property">
     <xsd:simpleContent>
       <xsd:extension base="xsd:string">
         <xsd:attribute name="name" type="xsd:string" use="required"/>
       </xsd:extension>
     </xsd:simpleContent>
   </xsd:complexType>

 </xsd:schema>
  

Version:
$Id: Profile.java,v 1.23 2004/10/30 02:22:11 gonzo Exp $

Nested Class Summary
static class Profile.Key
          Container for resource keys in the form of XPath expressions.
 
Field Summary
static Profile DEFAULT
          Default profile.
static Profile EDGE
          Prototypical edge peer , i.e.
static Profile EDGE_HTTP
          Prototypical Http edge peer , i.e.
static Profile EDGE_TCP
          Prototypical Tcp edge peer , i.e.
static Profile LOCAL
          Local/loopback/standalone services.
private static org.apache.log4j.Logger LOG
           
private  Resource profile
           
private static java.util.HashMap profiles
           
static Profile RELAY
          Prototypical relay peer , i.e.
static Profile RELAY_HTTP
          Prototypical HTTP relay peer , i.e.
static Profile RELAY_TCP
          Prototypical TCP relay peer , i.e.
static Profile RENDEZVOUS
          Prototypical rendezVous peer , i.e.
static Profile RENDEZVOUS_HTTP
          Prototypical HTTP rendezVous peer , i.e.
static Profile RENDEZVOUS_TCP
          Prototypical TCP rendezVous peer , i.e.
private static java.lang.String RESOURCE_BASE
           
protected static Profile SEED
          Description of the Field
static Profile SUPER
          Prototypical super peer , i.e.
static Profile SUPER_HTTP
          Prototypical HTTP super peer , i.e.
static Profile SUPER_TCP
          Prototypical TCP super peer , i.e.
 
Constructor Summary
  Profile(java.io.InputStream is)
           
private Profile(java.lang.String profile)
          Constructor for the Profile object
  Profile(java.net.URL profile)
          Constructor for the Profile object.
 
Method Summary
static void add(java.lang.String name, Profile profile)
          Add a new, named profile to the list of available profiles
static Profile get(java.lang.String profile)
          Instantiate a Profile for the named profile.
protected  Resource getProfile()
          Gets the profile attribute of the Profile object
static java.util.Iterator getProfiles()
          Get unsorted list of names for available profiles
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EDGE

public static final Profile EDGE
Prototypical edge peer , i.e. no RendezVous or Relay service.


EDGE_TCP

public static final Profile EDGE_TCP
Prototypical Tcp edge peer , i.e. no RendezVous or Relay service.


EDGE_HTTP

public static final Profile EDGE_HTTP
Prototypical Http edge peer , i.e. no RendezVous or Relay service.


SUPER

public static final Profile SUPER
Prototypical super peer , i.e. provisions RendezVous and Relay services.


SUPER_TCP

public static final Profile SUPER_TCP
Prototypical TCP super peer , i.e. provisions TCP RendezVous and Relay services.


SUPER_HTTP

public static final Profile SUPER_HTTP
Prototypical HTTP super peer , i.e. provisions HTTP RendezVous and Relay services.


RENDEZVOUS

public static final Profile RENDEZVOUS
Prototypical rendezVous peer , i.e. provisions RendezVous services


RENDEZVOUS_TCP

public static final Profile RENDEZVOUS_TCP
Prototypical TCP rendezVous peer , i.e. provisions TCP RendezVous services


RENDEZVOUS_HTTP

public static final Profile RENDEZVOUS_HTTP
Prototypical HTTP rendezVous peer , i.e. provisions HTTP RendezVous services


RELAY

public static final Profile RELAY
Prototypical relay peer , i.e. provisions Relay services.


RELAY_TCP

public static final Profile RELAY_TCP
Prototypical TCP relay peer , i.e. provisions TCP Relay services.


RELAY_HTTP

public static final Profile RELAY_HTTP
Prototypical HTTP relay peer , i.e. provisions HTTP Relay services.


LOCAL

public static final Profile LOCAL
Local/loopback/standalone services.


DEFAULT

public static final Profile DEFAULT
Default profile.

See Also:
EDGE 55

SEED

protected static final Profile SEED
Description of the Field


RESOURCE_BASE

private static final java.lang.String RESOURCE_BASE
See Also:
Constant Field Values

LOG

private static final org.apache.log4j.Logger LOG

profile

private Resource profile

profiles

private static java.util.HashMap profiles
Constructor Detail

Profile

public Profile(java.net.URL profile)
Constructor for the Profile object.


Profile

public Profile(java.io.InputStream is)

Profile

private Profile(java.lang.String profile)
Constructor for the Profile object

Method Detail

get

public static Profile get(java.lang.String profile)
Instantiate a Profile for the named profile.


getProfiles

public static java.util.Iterator getProfiles()
Get unsorted list of names for available profiles


add

public static void add(java.lang.String name,
                       Profile profile)
Add a new, named profile to the list of available profiles


getProfile

protected Resource getProfile()
Gets the profile attribute of the Profile object