Java Doc for RegistrationData.java in  » IDE-Netbeans » reglib » com » sun » servicetag » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » IDE Netbeans » reglib » com.sun.servicetag 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.sun.servicetag.RegistrationData

RegistrationData
public class RegistrationData (Code)
A RegistrationData object is a container of one or more RegistrationData.getServiceTags service tags that identify the components for product registration. Each RegistrationData object has a RegistrationData.getRegistrationURNuniform resource name (URN) as its identifier. It also has an environment map with the following elements:
hostname Hostname of the system e.g. woody
hostId Host ID of the system e.g. 83abc1ab
osName Operating system name e.g. SunOS
osVersion Operating system version e.g. 5.10
osArchitecture Operating system architecture e.g. sparc
systemModel System model e.g. SUNW,Sun-Fire-V440
systemManufacturer System manufacturer e.g. Sun Microsystems
cpuManufacturer CPU manufacturer e.g. Sun Microsystems
serialNumber System serial number e.g. BEL078932
The hostname and osName element must have a non-empty value. If an element is not available on a system and their value will be empty.

Registration XML Schema

A RegistrationData object can be RegistrationData.loadFromXML loaded from and RegistrationData.storeToXML stored into an XML file in the format described by the registration data schema. The registration data schema is defined by the Service Tags Technology.

Typically the registration data is constructed at installation time and stored in an XML file for later service tag lookup or registration.

Example Usage

The examples below show how the RegistrationData can be used for product registration. Exception handling is not shown in these examples for clarity.

  1. This example shows how the JDK creates a JDK service tag, installs it in the system service tag registry and adds it to the registration data.
     // create a service tag object with an instance_urn
     ServiceTag st = ServiceTag.newInstance(ServiceTag.generateInstanceURN(),
     ....);
     // Adds to the system service tag registry if supported
     if (Registry.isSupported()) {
     Registry.getSystemRegistry().addServiceTag(st);
     }
     // add to the registration data
     RegistrationData registration  = new RegistrationData();
     registration.addServiceTag(st); 
     
  2. At this point, the registration data is ready to send to Sun Connection for registration. This example shows how to register the JDK via the Registration Relay Service.

    There are several registration services for Sun Connection. For example, the Registration Relay Service is a web application interface that processes the registration data payload sent via HTTP post and hosts the registration user interface for a specified registration URL. Refer to the Registration Relay Service Specification for details.

     // Open the connection to the URL of the registration service
     HttpsURLConnection con = (HttpsURLConnection) url.openConnection();
     con.setDoInput(true);
     con.setDoOutput(true);
     con.setUseCaches(false);
     con.setAllowUserInteraction(false);
     con.setRequestMethod("POST");
     con.setRequestProperty("Content-Type", "text/xml;charset=\"utf-8\"");
     con.connect();
     // send the registration data to the registration service
     OutputStream out = con.getOutputStream();
     registration.storeToXML(out);
     out.close();
     
  3. This example shows how to store the registration data in an XML file. for later service tag lookup or registration.
     BufferedOutputStream out = new BufferedOutputStream(
     new FileOutputStream(""<JAVA_HOME>/lib/servicetag/registration.xml"));
     registration.storeToXML(out);
     out.close();
     
  4. This example shows how to install service tags that are in the registration data in the system service tag registry when determined to be available. The system service tag registry might not have existed when the registration data was constructed.
     if (Registry.isSupported()) {
     Set<ServiceTag> svctags = registration.getServiceTags();
     for (ServiceTag st : svctags) {
     Registry.getSystemRegistry().addServiceTag(st);
     }
     }
     

See Also:    Sun Connection Inventory Channel



Constructor Summary
public  RegistrationData()
     Creates a RegistrationData object with a generated RegistrationData.getRegistrationURN registration URN .
 RegistrationData(String urn)
    

Method Summary
public synchronized  ServiceTagaddServiceTag(ServiceTag st)
     Adds a service tag to this registration data.
public  Map<String, String>getEnvironmentMap()
     Returns a map containing the environment information for this registration data.
public  StringgetRegistrationURN()
    
public synchronized  ServiceTaggetServiceTag(String instanceURN)
     Returns a service tag of the given instance_urn in this registration data.
public  Set<ServiceTag>getServiceTags()
     Returns all service tags in this registration data.
public static  RegistrationDataloadFromXML(InputStream in)
     Reads the registration data from the XML document on the specified input stream.
public synchronized  ServiceTagremoveServiceTag(String instanceURN)
     Removes a service tag of the given instance_urn from this registration data.
Parameters:
  instanceURN - the instance_urn of the service tag to be removed.
public  voidsetEnvironment(String name, String value)
     Sets an element of the specified name in the environment map with the given value .
public  voidstoreToXML(OutputStream os)
     Writes the registration data to the specified output stream in the format described by the registration data schema with "UTF-8" encoding.
public  StringtoString()
     Returns a string representation of this registration data in XML format.
public  byte[]toXML()
     Returns a newly allocated byte array containing the registration data in XML format.
public synchronized  ServiceTagupdateServiceTag(String instanceURN, String productDefinedInstanceID)
     Updates the product_defined_instance_id in the service tag of the given instance_urn in this registration data.
Parameters:
  instanceURN - the instance_urn of the service tag to be updated.
Parameters:
  productDefinedInstanceID - the value of theproduct_defined_instance_id to be set.


Constructor Detail
RegistrationData
public RegistrationData()(Code)
Creates a RegistrationData object with a generated RegistrationData.getRegistrationURN registration URN . The following keys in the RegistrationData.getEnvironmentMap environment map will be initialized for the configuration of the running system:
hostname, osName, osVersion and osArchitecture
and the value of other keys may be empty.



RegistrationData
RegistrationData(String urn)(Code)




Method Detail
addServiceTag
public synchronized ServiceTag addServiceTag(ServiceTag st)(Code)
Adds a service tag to this registration data. If the given service tag has an empty instance_urn, this method will generate a URN and place it in the copy of the service tag in this registration data. This method will return the ServiceTag object added to this registration data.
Parameters:
  st - ServiceTag object to be added. a ServiceTag object added to this registration data.
throws:
  IllegalArgumentException - if a service tag of the same ServiceTag.getInstanceURN instance_urn already exists in the registry.



getEnvironmentMap
public Map<String, String> getEnvironmentMap()(Code)
Returns a map containing the environment information for this registration data. See the set of keys in the environment map. Subsequent update to the environment map via the RegistrationData.setEnvironment setEnvironment method will not be reflected in the returned map. an environment map for this registration data.



getRegistrationURN
public String getRegistrationURN()(Code)
Returns the uniform resource name of this registration data in this format: urn:st:<32-char java.util.UUID uuid > the URN of this registration data.



getServiceTag
public synchronized ServiceTag getServiceTag(String instanceURN)(Code)
Returns a service tag of the given instance_urn in this registration data.
Parameters:
  instanceURN - the instance_urn of the service tag the ServiceTag object of the given instance_urnif exists; otherwise return null .



getServiceTags
public Set<ServiceTag> getServiceTags()(Code)
Returns all service tags in this registration data. a Set Set of the service tagsin this registration data.



loadFromXML
public static RegistrationData loadFromXML(InputStream in) throws IOException(Code)
Reads the registration data from the XML document on the specified input stream. The XML document must be in the format described by the registration data schema. The specified stream is closed after this method returns.
Parameters:
  in - the input stream from which to read the XML document. a RegistrationData object read from the inputstream.
throws:
  IllegalArgumentException - if the input stream contains an invalid registration data.
throws:
  IOException - if an error occurred when reading from the input stream.



removeServiceTag
public synchronized ServiceTag removeServiceTag(String instanceURN)(Code)
Removes a service tag of the given instance_urn from this registration data.
Parameters:
  instanceURN - the instance_urn of the service tag to be removed. the removed ServiceTag object;or null if the service tag does not exist in this registration data.



setEnvironment
public void setEnvironment(String name, String value)(Code)
Sets an element of the specified name in the environment map with the given value .
throws:
  IllegalArgumentException - if name is not a valid keyin the environment map, or value is not valid.



storeToXML
public void storeToXML(OutputStream os) throws IOException(Code)
Writes the registration data to the specified output stream in the format described by the registration data schema with "UTF-8" encoding. The specified stream remains open after this method returns.
Parameters:
  os - the output stream on which to write the XML document.
throws:
  IOException - if an error occurred when writing to the output stream.



toString
public String toString()(Code)
Returns a string representation of this registration data in XML format. a string representation of this registration data in XMLformat.



toXML
public byte[] toXML()(Code)
Returns a newly allocated byte array containing the registration data in XML format. a newly allocated byte array containing the registrationdata in XML format.



updateServiceTag
public synchronized ServiceTag updateServiceTag(String instanceURN, String productDefinedInstanceID)(Code)
Updates the product_defined_instance_id in the service tag of the given instance_urn in this registration data.
Parameters:
  instanceURN - the instance_urn of the service tag to be updated.
Parameters:
  productDefinedInstanceID - the value of theproduct_defined_instance_id to be set. the updated ServiceTag object;or null if the service tag does not exist in this registration data.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.