summaryrefslogtreecommitdiffstats
path: root/sdo-java/branches/sdo-1.1-incubating/sdo-api/src/main/java/commonj/sdo/helper/TypeHelper.java
blob: 6281a257b1ba10228b940a83318bcf55c6f92809 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/**
 * <copyright>
 *
 * Service Data Objects
 * Version 2.1.0
 * Licensed Materials
 *
 * (c) Copyright BEA Systems, Inc., International Business Machines Corporation, 
 * Oracle Corporation, Primeton Technologies Ltd., Rogue Wave Software, SAP AG., 
 * Software AG., Sun Microsystems, Sybase Inc., Xcalia, Zend Technologies, 
 * 2005, 2006. All rights reserved.
 *
 * </copyright>
 * 
 */

package commonj.sdo.helper;

import java.util.List;

import commonj.sdo.DataObject;
import commonj.sdo.Property;
import commonj.sdo.Type;
import commonj.sdo.impl.HelperProvider;

/**
 * Look up a Type given the uri and typeName or interfaceClass.
 * SDO Types are available through the
 *   getType("commonj.sdo", typeName) method.
 * Defines Types from DataObjects.
 */
public interface TypeHelper
{
  /**
   * Return the Type specified by typeName with the given uri,
   *   or null if not found.
   * @param uri The uri of the Type - type.getURI();
   * @param typeName The name of the Type - type.getName();
   * @return the Type specified by typeName with the given uri,
   *   or null if not found.
   */
  Type getType(String uri, String typeName);
  
  /**
   * Return the Type for this interfaceClass or null if not found.
   * @param interfaceClass is the interface for the DataObject's Type -  
   *   type.getInstanceClass();
   * @return the Type for this interfaceClass or null if not found.
   */
  Type getType(Class interfaceClass);
  
  /**
   * Get the open content (global) Property with the specified uri and name, or null
   * if not found.
   * @param uri the namespace URI of the open content Property.
   * @param propertyName the name of the open content Property.
   * @return the global Property.
   */
  Property getOpenContentProperty(String uri, String propertyName);
  
  /**
   * Define the DataObject as a Type.
   * The Type is available through TypeHelper and DataGraph getType() methods.
   * @param type the DataObject representing the Type.
   * @return the defined Type.
   * @throws IllegalArgumentException if the Type could not be defined.
   */
  Type define(DataObject type);

  /**
   * Define the list of DataObjects as Types.
   * The Types are available through TypeHelper and DataGraph getType() methods.
   * @param types a List of DataObjects representing the Types.
   * @return the defined Types.
   * @throws IllegalArgumentException if the Types could not be defined.
   */
  List /*Type*/ define(List /*DataObject*/ types);

  /**
   * Define the DataObject as a Property for setting open content.
   * The containing Type of the open content property is not specified by SDO.
   * If the specified uri is not null the defined property is accessible through
   * TypeHelper.getOpenContentProperty(uri, propertyName).
   * If a null uri is specified, the location and management of the open content property
   * is not specified by SDO.
   * @param uri the namespace URI of the open content Property or null.
   * @return the defined open content Property.
   * @throws IllegalArgumentException if the Property could not be defined.
   */
  Property defineOpenContentProperty(String uri, DataObject property);

  /**
   * The default TypeHelper.
   */
  TypeHelper INSTANCE = HelperProvider.getTypeHelper();
}