Dresden OCL Toolkit

tudresden.ocl.sql
Class OCL2SQL

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended bytudresden.ocl.sql.OCL2SQL
All Implemented Interfaces:
Accessible, ActionListener, EventListener, ImageObserver, MenuContainer, Serializable

public class OCL2SQL
extends JPanel
implements ActionListener

OCL2SQL is the main class of the OCL2SQL tool. It manages all the different components and the flow of information between them which generate some kind of SQL code. These components are:

The purpose of the tool is to demonstrate the usability of UML/OCL in database design. It therefore takes an arbitrary UML model from an XMI source file and a number of OCL invariants and generates DDL (Data Definition Language) scripts that are executable on database systems. The following scripts are going to be generated during a project run:

Author:
Sten Loecher
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected  JButton bExecute
           
protected  JButton bLoadConstraints
           
protected  JButton bLoadXmi
           
protected  JButton bProjectDirectory
           
protected  JButton bSaveConstraints
           
protected  JButton bXmiSource
           
protected  JComboBox cbPKType
           
protected  JDialog dlgProgress
           
private  String fileNameIntegrityViews
           
private  String fileNameObjectViews
           
private  String fileNameTableSchema
           
private  String fileNameTrigger
           
static String INTERR
           
private  List lIntegrityViews
           
private  int ormClassToTableMode
           
private  int ormNumOfPKColumns
           
private  boolean ormOneTablePerAss
           
private  String ormPKColType
           
protected  JLabel progressLabel
           
protected  JRadioButton rbAssociations0
           
protected  JRadioButton rbAssociations1
           
protected  JRadioButton rbInheritance0
           
protected  JRadioButton rbInheritance1
           
protected  JRadioButton rbInheritance2
           
protected  JRadioButton rbTriggerAssertion
           
protected  JRadioButton rbTriggerECA
           
protected  JRadioButton rbTriggerNone
           
private  String resultIntegrityViews
           
private  String resultObjectViews
           
private  String resultTableSchema
           
private  String resultTrigger
           
private  String rulesFileLocation
           
private  String sqlCodeGenPatternCatalogue
           
protected  JTabbedPane tabs
           
protected  JTextArea taProgress
           
protected  JTextArea taResultIntegrityViews
           
protected  JTextArea taResultObjectViews
           
protected  JTextArea taResultTables
           
protected  JTextArea taResultTrigger
           
protected  JTextField tfPKNoCol
           
protected  JTextField tfProjectDirectory
           
protected  JTextField tfXmiSource
           
protected  JFrame theMainFrame
           
private  ModelFacade theModelFacade
           
private  ObjectViewSchema theObjectViewSchema
           
private  OCLEditor theOCLEditor
           
private  SimpleOCLEditorModel theOCLEditorModel
           
private  ORMapping theORMapping
           
private  String theProjectDirectory
           
private  Model theRoughModel
           
private  SQLBuilder theSQLBuilder
           
private  ILSQLCodeGenerator theSQLCodeGenerator
           
static String TRIGGER
           
private  String xmiFileLocation
           
 
Fields inherited from class javax.swing.JPanel
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Container
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
OCL2SQL(JFrame theMainFrame)
          The constructor.
 
Method Summary
 void actionPerformed(ActionEvent event)
          Manages the user input from the gui.
protected  void buildGUI()
          Builds the gui.
private  void closeProgressWindows()
          Helper methode.
 void executeProject()
          Executes the project with the specified parameters.
protected  JPanel getAboutPane()
           
protected  Icon getImage(String name)
          Code originally from ConstraintEvaluation.
protected  JPanel getInputPane()
           
protected  JPanel getOutputPane()
           
protected  JPanel getProjectPane()
           
private  void increaseProgressInfo(String msg)
          Helper methode.
private  void loadConstraints()
          Loads some OCL constraints from a source file.
private  void loadProjectPath()
          Offers a dialog box to specify the project path.
private  void loadXmiSource()
          Loads the class model from the specified XMI file.
private  void loadXmiSourceURL()
          Offers a dialog box to specify the location of a XMI file.
static void main(String[] args)
          Main methode to start the gui of the OCL2SQL tool.
private  void prepareProgressInfo()
          Helper methode.
 boolean prepareProjectExecution()
          Prepares the project execution.
private  void saveConstraints()
          Saves the specified OCL constraints to a file.
private  void saveResults()
          Stores the resulting DDL scripts from project execution to according files.
private  void showMessage(String title, String message, int type)
          Helper methode.
private  boolean synchronizeObjectState()
          Reads the input data from the gui and updates the class parameters accordingly.
private  void updateOutputPane()
          Updates the output pane after project execution.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

xmiFileLocation

private String xmiFileLocation

rulesFileLocation

private String rulesFileLocation

theProjectDirectory

private String theProjectDirectory

theModelFacade

private ModelFacade theModelFacade

theRoughModel

private Model theRoughModel

theOCLEditorModel

private SimpleOCLEditorModel theOCLEditorModel

theOCLEditor

private OCLEditor theOCLEditor

theORMapping

private ORMapping theORMapping

theObjectViewSchema

private ObjectViewSchema theObjectViewSchema

theSQLBuilder

private SQLBuilder theSQLBuilder

theSQLCodeGenerator

private ILSQLCodeGenerator theSQLCodeGenerator

ormClassToTableMode

private int ormClassToTableMode

ormNumOfPKColumns

private int ormNumOfPKColumns

ormPKColType

private String ormPKColType

ormOneTablePerAss

private boolean ormOneTablePerAss

lIntegrityViews

private List lIntegrityViews

resultTableSchema

private String resultTableSchema

resultObjectViews

private String resultObjectViews

resultIntegrityViews

private String resultIntegrityViews

resultTrigger

private String resultTrigger

fileNameTableSchema

private String fileNameTableSchema

fileNameObjectViews

private String fileNameObjectViews

fileNameIntegrityViews

private String fileNameIntegrityViews

fileNameTrigger

private String fileNameTrigger

sqlCodeGenPatternCatalogue

private String sqlCodeGenPatternCatalogue

tabs

protected JTabbedPane tabs

bLoadConstraints

protected JButton bLoadConstraints

bSaveConstraints

protected JButton bSaveConstraints

bXmiSource

protected JButton bXmiSource

bLoadXmi

protected JButton bLoadXmi

bProjectDirectory

protected JButton bProjectDirectory

bExecute

protected JButton bExecute

tfXmiSource

protected JTextField tfXmiSource

tfProjectDirectory

protected JTextField tfProjectDirectory

tfPKNoCol

protected JTextField tfPKNoCol

rbInheritance0

protected JRadioButton rbInheritance0

rbInheritance1

protected JRadioButton rbInheritance1

rbInheritance2

protected JRadioButton rbInheritance2

rbAssociations0

protected JRadioButton rbAssociations0

rbAssociations1

protected JRadioButton rbAssociations1

rbTriggerAssertion

protected JRadioButton rbTriggerAssertion

rbTriggerECA

protected JRadioButton rbTriggerECA

rbTriggerNone

protected JRadioButton rbTriggerNone

cbPKType

protected JComboBox cbPKType

taResultTables

protected JTextArea taResultTables

taResultObjectViews

protected JTextArea taResultObjectViews

taResultIntegrityViews

protected JTextArea taResultIntegrityViews

taResultTrigger

protected JTextArea taResultTrigger

taProgress

protected JTextArea taProgress

dlgProgress

protected JDialog dlgProgress

theMainFrame

protected JFrame theMainFrame

progressLabel

protected JLabel progressLabel

TRIGGER

public static String TRIGGER

INTERR

public static String INTERR
Constructor Detail

OCL2SQL

public OCL2SQL(JFrame theMainFrame)
The constructor.

Parameters:
theMainFrame - a main frame for the gui
Method Detail

main

public static void main(String[] args)
Main methode to start the gui of the OCL2SQL tool.


buildGUI

protected void buildGUI()
Builds the gui.


getInputPane

protected JPanel getInputPane()
Returns:
the input panel

getProjectPane

protected JPanel getProjectPane()
Returns:
the project panel

getOutputPane

protected JPanel getOutputPane()
Returns:
the output panel

getAboutPane

protected JPanel getAboutPane()
Returns:
the about panel

synchronizeObjectState

private boolean synchronizeObjectState()
Reads the input data from the gui and updates the class parameters accordingly.


updateOutputPane

private void updateOutputPane()
Updates the output pane after project execution.


actionPerformed

public void actionPerformed(ActionEvent event)
Manages the user input from the gui.

Specified by:
actionPerformed in interface ActionListener

loadConstraints

private void loadConstraints()
Loads some OCL constraints from a source file. Offers a dialog box to specify the location of the file.


saveConstraints

private void saveConstraints()
Saves the specified OCL constraints to a file. Offers a dialog box to specify the location of the file.


loadXmiSourceURL

private void loadXmiSourceURL()
Offers a dialog box to specify the location of a XMI file.


loadXmiSource

private void loadXmiSource()
Loads the class model from the specified XMI file.


loadProjectPath

private void loadProjectPath()
Offers a dialog box to specify the project path. The resulting scripts are going to be stored to this location.


getImage

protected Icon getImage(String name)
Code originally from ConstraintEvaluation.


showMessage

private void showMessage(String title,
                         String message,
                         int type)
Helper methode. Shows a message.


prepareProgressInfo

private void prepareProgressInfo()
Helper methode. Prepares a progress info dialog.


increaseProgressInfo

private void increaseProgressInfo(String msg)
Helper methode. Shows a message in the progress info dialog.


closeProgressWindows

private void closeProgressWindows()
Helper methode. Closes the progress info dialog.


prepareProjectExecution

public boolean prepareProjectExecution()
Prepares the project execution. The following steps will be done:


executeProject

public void executeProject()
Executes the project with the specified parameters.


saveResults

private void saveResults()
Stores the resulting DDL scripts from project execution to according files.


Dresden OCL Toolkit

Submit a bug
Developed at the Dresden University of Technology.
This software is published under the GNU Lesser General Public License.