org.argouml.model.uml
Class UmlFactory

java.lang.Object
  |
  +--org.argouml.model.uml.AbstractUmlModelFactory
        |
        +--org.argouml.model.uml.UmlFactory

public class UmlFactory
extends AbstractUmlModelFactory

Root factory for UML model element instance creation.

Since:
ARGO0.11.2

Nested Class Summary
(package private)  class UmlFactory.ObjectCreateInfo
           
 
Field Summary
private  boolean _jmiProxyCreated
           
private  java.util.Map _validConnectionMap
          A map of valid connections keyed by the connection type.
protected static Logger cat
          Deprecated. by Linus Tolke as of 0.15.4. Use your own logger in your class. This will be removed.
private static java.util.Hashtable elements
           
private static UmlFactory SINGLETON
          Singleton instance.
private static java.lang.Object[][] VALID_CONNECTIONS
           
 
Fields inherited from class org.argouml.model.uml.AbstractUmlModelFactory
 
Constructor Summary
private UmlFactory()
          Don't allow external instantiation.
 
Method Summary
 java.lang.Object buildConnection(java.lang.Object connectionType, java.lang.Object fromElement, java.lang.Object toElement)
          Create a new connection model element (a relationship or link) between any existing node model elements.
 java.lang.Object buildConnection(java.lang.Object connectionType, java.lang.Object fromElement, java.lang.Object fromStyle, java.lang.Object toElement, java.lang.Object toStyle, java.lang.Object unidirectional)
           
private  void buildValidConnectionMap()
           
 java.lang.Object create(java.lang.String entity)
          Create a UML object from the implementation name.
 java.lang.Object create(UmlModelEntity entity)
          Create a UML object from the implementation.
 MActionExpression createActionExpression()
          Create an empty but initialized instance of a UML ActionExpression.
 void delete(java.lang.Object elem)
          Deletes a modelelement.
private  void deleteAction(java.lang.Object elem)
          Factored this method out of delete to simplify the design of the delete operation
private  void deleteEvent(MEvent elem)
          Factored this method out of delete to simplify the design of the delete operation
private  void deleteFeature(MFeature elem)
          Factored this method out of delete to simplify the design of the delete operation
private  void deleteInstance(MInstance elem)
          Factored this method out of delete to simplify the design of the delete operation
private  void deleteNamespace(MNamespace elem)
          Factored this method out of delete to simplify the design of the delete operation
private  void deleteRelationship(MRelationship elem)
          Factored this method out of delete to simplify the design of the delete operation
private  void deleteStateVertex(MStateVertex elem)
          Factored this method out of delete to simplify the design of the delete operation
 void doCopyBase(MBase source, MBase target)
          Deprecated. by Linus Tolke as of 0.15.4. Should be made private (if at all used).
 ActivityGraphsFactory getActivityGraphs()
          Returns the package factory for the UML package BehavioralElements::ActivityGraphs.
 CollaborationsFactory getCollaborations()
          Returns the package factory for the UML package BehavioralElements::Collaborations.
 CommonBehaviorFactory getCommonBehavior()
          Returns the package factory for the UML package BehavioralElements::CommonBehavior.
 CoreFactory getCore()
          Returns the package factory for the UML package Foundation::Core.
 DataTypesFactory getDataTypes()
          Returns the package factory for the UML package Foundation::DataTypes.
 ExtensionMechanismsFactory getExtensionMechanisms()
          Returns the package factory for the UML package Foundation::ExtensionMechanisms.
static UmlFactory getFactory()
          Singleton instance access method.
 ModelManagementFactory getModelManagement()
          Returns the package factory for the UML package ModelManagement.
 StateMachinesFactory getStateMachines()
          Returns the package factory for the UML package BehavioralElements::StateMachines.
 UseCasesFactory getUseCases()
          Returns the package factory for the UML package BehavioralElements::UseCases.
private  void initializeFactoryMethods()
           
 boolean isConnectionValid(java.lang.Object connectionType, java.lang.Object fromElement, java.lang.Object toElement)
           
 boolean isJmiProxyCreated()
           
 void setJmiProxyCreated(boolean arg)
           
 
Methods inherited from class org.argouml.model.uml.AbstractUmlModelFactory
addListenersToModelElement, initialize, isGuiEnabled, setGuiEnabled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cat

protected static Logger cat
Deprecated. by Linus Tolke as of 0.15.4. Use your own logger in your class. This will be removed.


_validConnectionMap

private java.util.Map _validConnectionMap
A map of valid connections keyed by the connection type. The constructor builds this from the data in the VALID_CONNECTIONS array


_jmiProxyCreated

private boolean _jmiProxyCreated

VALID_CONNECTIONS

private static final java.lang.Object[][] VALID_CONNECTIONS

SINGLETON

private static final UmlFactory SINGLETON
Singleton instance.


elements

private static java.util.Hashtable elements
Constructor Detail

UmlFactory

private UmlFactory()
Don't allow external instantiation.

Method Detail

getFactory

public static UmlFactory getFactory()
Singleton instance access method.

Returns:
the singleton.

buildValidConnectionMap

private void buildValidConnectionMap()

initializeFactoryMethods

private void initializeFactoryMethods()

isJmiProxyCreated

public boolean isJmiProxyCreated()
Returns:
boolean to indicate if the JMI Reflective Proxy over NSUML is created.

setJmiProxyCreated

public void setJmiProxyCreated(boolean arg)
Parameters:
arg - true to cause the JMI Reflective proxy over NSUML to be used.

buildConnection

public java.lang.Object buildConnection(java.lang.Object connectionType,
                                        java.lang.Object fromElement,
                                        java.lang.Object toElement)
                                 throws IllegalModelElementConnectionException
Create a new connection model element (a relationship or link) between any existing node model elements.

Parameters:
connectionType - is the type of relationship
fromElement - is an existing model element
toElement - is another existing model element
Returns:
the newly created connection element
Throws:
IllegalModelElementConnectionException

buildConnection

public java.lang.Object buildConnection(java.lang.Object connectionType,
                                        java.lang.Object fromElement,
                                        java.lang.Object fromStyle,
                                        java.lang.Object toElement,
                                        java.lang.Object toStyle,
                                        java.lang.Object unidirectional)
                                 throws IllegalModelElementConnectionException
IllegalModelElementConnectionException

isConnectionValid

public boolean isConnectionValid(java.lang.Object connectionType,
                                 java.lang.Object fromElement,
                                 java.lang.Object toElement)

getExtensionMechanisms

public ExtensionMechanismsFactory getExtensionMechanisms()
Returns the package factory for the UML package Foundation::ExtensionMechanisms.

Returns:
the ExtensionMechanisms factory instance.

getDataTypes

public DataTypesFactory getDataTypes()
Returns the package factory for the UML package Foundation::DataTypes.

Returns:
the DataTypes factory instance.

getCore

public CoreFactory getCore()
Returns the package factory for the UML package Foundation::Core.

Returns:
the Core factory instance.

getCommonBehavior

public CommonBehaviorFactory getCommonBehavior()
Returns the package factory for the UML package BehavioralElements::CommonBehavior.

Returns:
the CommonBehavior factory instance.

getUseCases

public UseCasesFactory getUseCases()
Returns the package factory for the UML package BehavioralElements::UseCases.

Returns:
the UseCases factory instance.

getStateMachines

public StateMachinesFactory getStateMachines()
Returns the package factory for the UML package BehavioralElements::StateMachines.

Returns:
the StateMachines factory instance.

getCollaborations

public CollaborationsFactory getCollaborations()
Returns the package factory for the UML package BehavioralElements::Collaborations.

Returns:
the Collaborations factory instance.

getActivityGraphs

public ActivityGraphsFactory getActivityGraphs()
Returns the package factory for the UML package BehavioralElements::ActivityGraphs.

Returns:
the ActivityGraphs factory instance.

getModelManagement

public ModelManagementFactory getModelManagement()
Returns the package factory for the UML package ModelManagement.

Returns:
the ModelManagement factory instance.

delete

public void delete(java.lang.Object elem)
Deletes a modelelement. It calls the remove method of the modelelement but also does 'cascading deletes' that are not provided for in the remove method of the modelelement itself. For example: this delete method also removes the binary associations that a class has if the class is deleted. In this way, it is not longer possible that illegal states exist in the model.

The actual deletion is delegated to delete methods in the rest of the factories. For example: a method deleteClass exists on CoreHelper. Delete methods as deleteClass should only do those extra actions that are necessary for the deletion of the modelelement itself. I.e. deleteClass should only take care of things specific to MClass.

The delete methods in the UML Factories should not be called directly throughout the code! Calls should allways refer to this method and never call the deleteXXX method on XXXFactory directly. The reason that it is possible to call the deleteXXX methods directly is a pure implementation detail.

The implementation of this method uses a quite complicate if then else tree. This is done to provide optimal performance and full compliance to the UML 1.3 model. The last remark refers to the fact that the UML 1.3 model knows multiple inheritance in several places. This has to be taken into account.

Extensions and its children are not taken into account here. They do not require extra cleanup actions. Not in the form of a call to the remove method as is normal for all children of MBase and not in the form of other behaviour we want to implement via this operation.

Parameters:
elem - The element to be deleted

deleteFeature

private void deleteFeature(MFeature elem)
Factored this method out of delete to simplify the design of the delete operation

Parameters:
elem -

deleteNamespace

private void deleteNamespace(MNamespace elem)
Factored this method out of delete to simplify the design of the delete operation

Parameters:
elem -

deleteRelationship

private void deleteRelationship(MRelationship elem)
Factored this method out of delete to simplify the design of the delete operation

Parameters:
elem -

deleteAction

private void deleteAction(java.lang.Object elem)
Factored this method out of delete to simplify the design of the delete operation

Parameters:
elem -

deleteInstance

private void deleteInstance(MInstance elem)
Factored this method out of delete to simplify the design of the delete operation

Parameters:
elem -

deleteStateVertex

private void deleteStateVertex(MStateVertex elem)
Factored this method out of delete to simplify the design of the delete operation

Parameters:
elem -

deleteEvent

private void deleteEvent(MEvent elem)
Factored this method out of delete to simplify the design of the delete operation

Parameters:
elem -

doCopyBase

public void doCopyBase(MBase source,
                       MBase target)
Deprecated. by Linus Tolke as of 0.15.4. Should be made private (if at all used).

Used by the copy functions. Do not call this function directly.

Extensions? I don't think we use them anywhere.


createActionExpression

public MActionExpression createActionExpression()
Create an empty but initialized instance of a UML ActionExpression.

Returns:
an initialized UML ActionExpression instance.

create

public java.lang.Object create(java.lang.String entity)
Create a UML object from the implementation name. This will allow abstraction of the create mechanism at a single point.

Parameters:
entity - name to create - must be implemented in Uml.
Returns:
the entity requested or null if unable to create

create

public java.lang.Object create(UmlModelEntity entity)
Create a UML object from the implementation. This will allow abstraction of the create mechanism at a single point.

Parameters:
entity - Class to create - must implement UmlModelEntity
Returns:
the created entity or null if unable to create


ArgoUML © 1996-2004 (20040306)ArgoUML HomepageArgoUML Developers' pageArgoUML Cookbook