Java Doc for SchemaTransformer.java in  » UML » AndroMDA-3.2 » org » andromda » schema2xmi » 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 » UML » AndroMDA 3.2 » org.andromda.schema2xmi 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.andromda.schema2xmi.SchemaTransformer

SchemaTransformer
public class SchemaTransformer (Code)
Performs the transformation of database schema to XMI.
author:
   Chad Brandon



Constructor Summary
public  SchemaTransformer(String jdbcDriver, String jdbcConnectionUrl, String jdbcUser, String jdbcPassword)
     Constructs a new instance of this SchemaTransformer.

Method Summary
protected  voidaddForeignKey(String tableName, String columnName)
     Adds a foreign key column name to the foreignKeys Map.
protected  CollectioncreateAssociations(DatabaseMetaData metadata, CorePackage corePackage, String tableName)
     Creates and returns a collection of associations by determing foreign tables to the table having the given tableName.
Parameters:
  metadata - the DatabaseMetaData from which to retrieve the columns.
Parameters:
  corePackage - used to create the class.
Parameters:
  tableName - the tableName for which to find columns.
protected  MultiplicitycreateAttributeMultiplicity(DataTypesPackage dataTypes, boolean required)
     Creates an attributes multiplicity, if required is true, then multiplicity is set to 1, if required is false, then multiplicity is set to 0..1.
Parameters:
  dataTypes - used to create the Multiplicity
Parameters:
  required - whether or not the attribute is required thereforedetermining the multiplicity value created.
protected  CollectioncreateAttributes(DatabaseMetaData metadata, CorePackage corePackage, String tableName)
     Creates and returns a collection of attributes from creating an attribute from every column on the table having the give tableName.
Parameters:
  metadata - the DatabaseMetaData from which to retrieve the columns.
Parameters:
  corePackage - used to create the class.
Parameters:
  tableName - the tableName for which to find columns.
protected  UmlClasscreateClass(org.omg.uml.modelmanagement.UmlPackage modelPackage, DatabaseMetaData metadata, CorePackage corePackage, String tableName)
     Creates and returns a UmlClass with the given name using the corePackage to create it.
Parameters:
  corePackage - used to create the class.
Parameters:
  tableName - to tableName for which we'll create the appropriateclass.
protected  voidcreateClasses(Connection connection, CorePackage corePackage, org.omg.uml.modelmanagement.UmlPackage modelPackage)
     Creates all classes from the tables found in the schema.
protected  MultiplicitycreateMultiplicity(DataTypesPackage dataTypes, int lower, int upper)
     Creates a multiplicity, from lower and upper ranges.
protected  TaggedValuecreateTaggedValue(CorePackage corePackage, String name, String value)
     Creates a tagged value given the specfied name.
Parameters:
  name - the name of the tagged value to create.
Parameters:
  value - the value to populate on the tagged value.
protected  DataTypegetOrCreateDataType(CorePackage corePackage, String type)
     Gets or creates a new data type instance having the given fully qualified type name.
Parameters:
  corePackage - the core package
Parameters:
  type - the fully qualified type name.
protected  org.omg.uml.modelmanagement.UmlPackagegetOrCreatePackage(ModelManagementPackage modelManagementPackage, org.omg.uml.modelmanagement.UmlPackage modelPackage, String packageName)
     Gets or creates a package having the specified packageName using the given modelManagementPackage, places it on the model and returns the last leaf package.
protected  CollectiongetOrCreateStereotypes(CorePackage corePackage, String names, String baseClass)
     Gets or creates a stereotypes given the specfied comma seperated list of names.
protected  CollectiongetPrimaryKeyColumns(DatabaseMetaData metadata, String tableName)
     Returns a collection of all primary key column names for the given tableName.
protected  booleanhasForeignKey(String tableName, String columnName)
     Returns true if the table with the given tableName has a foreign key with the specified columnName.
Parameters:
  tableName - the name of the table to check for the foreign key
Parameters:
  columnName - the naem of the foreign key column.
protected  booleanisColumnNullable(DatabaseMetaData metadata, String tableName, String columnName)
     This method just checks to see if a column is null able or not, if so, returns true, if not returns false.
Parameters:
  metadata - the DatabaseMetaData instance used to retrieve the columninformation.
Parameters:
  tableName - the name of the table on which the column exists.
Parameters:
  columnName - the name of the column.
public  voidsetClassStereotypes(String classStereotypes)
     Sets the stereotype name for the new classes.
public  voidsetColumnNamePattern(String columnNamePattern)
     Sets the regular expression pattern to match on when deciding what attributes ti create in the XMI.
public  voidsetColumnTaggedValue(String columnTaggedValue)
     Sets the name of the column tagged value to use for storing the name of the column.
public  voidsetIdentifierStereotypes(String identifierStereotypes)
     Sets the stereotype name for the identifiers on the new classes.
public  voidsetPackageName(String packageName)
     Sets the name of the package to which the model elements will be created.
public  voidsetSchema(String schema)
     Sets the name of the schema (where the tables can be found).
public  voidsetTableNamePattern(String tableNamePattern)
     Sets the regular expression pattern to match on when deciding what table names to add to the transformed XMI.
public  voidsetTableTaggedValue(String tableTaggedValue)
     Sets the name of the table tagged value to use for storing the name of the table.
public  voidsetTypeMappings(String typeMappingsUri)
     Sets the mappingsUri which is the URI to the sql types to model type mappings.
public  voidsetXmiVersion(String xmiVersion)
     Sets the version of XMI that will be produced.
public  voidtransform(String inputModel, String outputLocation)
     Transforms the Schema file and writes it to the location given by outputLocation.


Constructor Detail
SchemaTransformer
public SchemaTransformer(String jdbcDriver, String jdbcConnectionUrl, String jdbcUser, String jdbcPassword)(Code)
Constructs a new instance of this SchemaTransformer.




Method Detail
addForeignKey
protected void addForeignKey(String tableName, String columnName)(Code)
Adds a foreign key column name to the foreignKeys Map. The map stores a collection of foreign key names keyed by the given tableName
Parameters:
  tableName - the name of the table for which to store the keys.
Parameters:
  columnName - the name of the foreign key column name.



createAssociations
protected Collection createAssociations(DatabaseMetaData metadata, CorePackage corePackage, String tableName) throws SQLException(Code)
Creates and returns a collection of associations by determing foreign tables to the table having the given tableName.
Parameters:
  metadata - the DatabaseMetaData from which to retrieve the columns.
Parameters:
  corePackage - used to create the class.
Parameters:
  tableName - the tableName for which to find columns. the collection of new attributes.



createAttributeMultiplicity
protected Multiplicity createAttributeMultiplicity(DataTypesPackage dataTypes, boolean required)(Code)
Creates an attributes multiplicity, if required is true, then multiplicity is set to 1, if required is false, then multiplicity is set to 0..1.
Parameters:
  dataTypes - used to create the Multiplicity
Parameters:
  required - whether or not the attribute is required thereforedetermining the multiplicity value created. the new Multiplicity



createAttributes
protected Collection createAttributes(DatabaseMetaData metadata, CorePackage corePackage, String tableName) throws SQLException(Code)
Creates and returns a collection of attributes from creating an attribute from every column on the table having the give tableName.
Parameters:
  metadata - the DatabaseMetaData from which to retrieve the columns.
Parameters:
  corePackage - used to create the class.
Parameters:
  tableName - the tableName for which to find columns. the collection of new attributes.



createClass
protected UmlClass createClass(org.omg.uml.modelmanagement.UmlPackage modelPackage, DatabaseMetaData metadata, CorePackage corePackage, String tableName)(Code)
Creates and returns a UmlClass with the given name using the corePackage to create it.
Parameters:
  corePackage - used to create the class.
Parameters:
  tableName - to tableName for which we'll create the appropriateclass. the UmlClass



createClasses
protected void createClasses(Connection connection, CorePackage corePackage, org.omg.uml.modelmanagement.UmlPackage modelPackage) throws SQLException(Code)
Creates all classes from the tables found in the schema.
Parameters:
  connection - the Connection used to retrieve the schema metadata.
Parameters:
  corePackage - the CorePackage instance we use to create the classes.
Parameters:
  modelPackage - the package which the classes are added.



createMultiplicity
protected Multiplicity createMultiplicity(DataTypesPackage dataTypes, int lower, int upper)(Code)
Creates a multiplicity, from lower and upper ranges.
Parameters:
  dataTypes - used to create the Multiplicity
Parameters:
  lower - the lower range of the multiplicity
Parameters:
  upper - the upper range of the multiplicity the new Multiplicity



createTaggedValue
protected TaggedValue createTaggedValue(CorePackage corePackage, String name, String value)(Code)
Creates a tagged value given the specfied name.
Parameters:
  name - the name of the tagged value to create.
Parameters:
  value - the value to populate on the tagged value. returns the new TaggedValue



getOrCreateDataType
protected DataType getOrCreateDataType(CorePackage corePackage, String type)(Code)
Gets or creates a new data type instance having the given fully qualified type name.
Parameters:
  corePackage - the core package
Parameters:
  type - the fully qualified type name. the DataType



getOrCreatePackage
protected org.omg.uml.modelmanagement.UmlPackage getOrCreatePackage(ModelManagementPackage modelManagementPackage, org.omg.uml.modelmanagement.UmlPackage modelPackage, String packageName)(Code)
Gets or creates a package having the specified packageName using the given modelManagementPackage, places it on the model and returns the last leaf package.
Parameters:
  modelManagementPackage - from which we retrieve the UmlPackageClassto create a UmlPackage.
Parameters:
  modelPackage - the root UmlPackage



getOrCreateStereotypes
protected Collection getOrCreateStereotypes(CorePackage corePackage, String names, String baseClass)(Code)
Gets or creates a stereotypes given the specfied comma seperated list of names. If any of the stereotypes can't be found, they will be created.
Parameters:
  names - comma seperated list of stereotype names
Parameters:
  baseClass - the base class for which the stereotype applies. Collection of Stereotypes



getPrimaryKeyColumns
protected Collection getPrimaryKeyColumns(DatabaseMetaData metadata, String tableName) throws SQLException(Code)
Returns a collection of all primary key column names for the given tableName.
Parameters:
  metadata -
Parameters:
  tableName - collection of primary key names.



hasForeignKey
protected boolean hasForeignKey(String tableName, String columnName)(Code)
Returns true if the table with the given tableName has a foreign key with the specified columnName.
Parameters:
  tableName - the name of the table to check for the foreign key
Parameters:
  columnName - the naem of the foreign key column. true/false dependeing on whether or not the table has the foreignkey with the given columnName.



isColumnNullable
protected boolean isColumnNullable(DatabaseMetaData metadata, String tableName, String columnName) throws SQLException(Code)
This method just checks to see if a column is null able or not, if so, returns true, if not returns false.
Parameters:
  metadata - the DatabaseMetaData instance used to retrieve the columninformation.
Parameters:
  tableName - the name of the table on which the column exists.
Parameters:
  columnName - the name of the column. true/false on whether or not column is nullable.



setClassStereotypes
public void setClassStereotypes(String classStereotypes)(Code)
Sets the stereotype name for the new classes.
Parameters:
  classStereotypes - The classStereotypes to set.



setColumnNamePattern
public void setColumnNamePattern(String columnNamePattern)(Code)
Sets the regular expression pattern to match on when deciding what attributes ti create in the XMI.
Parameters:
  columnNamePattern - The pattern for filtering the column name.



setColumnTaggedValue
public void setColumnTaggedValue(String columnTaggedValue)(Code)
Sets the name of the column tagged value to use for storing the name of the column.
Parameters:
  columnTaggedValue - The columnTaggedValue to set.



setIdentifierStereotypes
public void setIdentifierStereotypes(String identifierStereotypes)(Code)
Sets the stereotype name for the identifiers on the new classes.
Parameters:
  identifierStereotypes - The identifierStereotypes to set.



setPackageName
public void setPackageName(String packageName)(Code)
Sets the name of the package to which the model elements will be created.
Parameters:
  packageName - The packageName to set.



setSchema
public void setSchema(String schema)(Code)
Sets the name of the schema (where the tables can be found).
Parameters:
  schema - The schema to set.



setTableNamePattern
public void setTableNamePattern(String tableNamePattern)(Code)
Sets the regular expression pattern to match on when deciding what table names to add to the transformed XMI.
Parameters:
  tableNamePattern - The tableNamePattern to set.



setTableTaggedValue
public void setTableTaggedValue(String tableTaggedValue)(Code)
Sets the name of the table tagged value to use for storing the name of the table.
Parameters:
  tableTaggedValue - The tableTaggedValue to set.



setTypeMappings
public void setTypeMappings(String typeMappingsUri)(Code)
Sets the mappingsUri which is the URI to the sql types to model type mappings.
Parameters:
  typeMappingsUri - The typeMappings to set.



setXmiVersion
public void setXmiVersion(String xmiVersion)(Code)
Sets the version of XMI that will be produced.
Parameters:
  xmiVersion - The xmiVersion to set.



transform
public void transform(String inputModel, String outputLocation)(Code)
Transforms the Schema file and writes it to the location given by outputLocation. The inputModel must be a valid URL, otherwise an exception will be thrown.
Parameters:
  inputModel - the location of the input model to start with (if thereis one)
Parameters:
  outputLocation - The location to where the transformed output willbe written.



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.