Atitit.uml2?api?的編程代碼實現設計uml開發?使用eclipse?jar?java?版本

 2023-12-06 阅读 29 评论 0

摘要:Atitit.uml2?api?的編程代碼實現設計uml開發?使用eclipse?jar?java?版本 ? ? 1.?clipse提供了UML的底層Java包, 1 2.?MDTUML2Getting?Started?with?UML21 3.?要使用的jar2 4.?矢量繪圖系統?java2 5.?JpGraph?3.0.72 6.?Code4 7.?Ref8 ? ? ? 1.?clipse提供了UML的底層J

Atitit.uml2?api?的編程代碼實現設計uml開發?使用eclipse?jar?java?版本

?

?

1.?clipse提供了UML的底層Java包, 1

2.?MDTUML2Getting?Started?with?UML21

3.?要使用的jar2

4.?矢量繪圖系統?java2

5.?JpGraph?3.0.72

6.?Code4

7.?Ref8

?

?

?

1.?clipse提供了UML的底層Java包,

就是說用純代碼可以構建一個UML模型,當構建完之后需要保存到磁盤上以備以后使用,該UML模型是以XML格式存放在磁盤上的,這篇文章正式演示了這個用純UML的底層API創建UML模型的。

?

?

2.?MDTUML2Getting?Started?with?UML2

1.?Contents

1.?Summary

1.?Prerequisites

2.?Introduction

3.?Getting?Started

4.?Creating?Models

5.?Creating?Packages

6.?Creating?Primitive?Types

7.?Creating?Enumerations

8.?Creating?Enumeration?Literals

9.?Creating?Classes

10.?Creating?Generalizations

11.?Creating?Attributes

12.?Creating?Associations

13.?Saving?Models

14.?Conclusion

15.?References

?

?

["E:\\jar2\\org.eclipse.emf.ecore_2.10.1.v20140901-1043.jar//org.eclipse.emf.ecore.resource.ResourceSet.class",

"E:\\jar2\\org.eclipse.emf.ecore_2.10.2.v20150123-0348.jar//org.eclipse.emf.ecore.resource.ResourceSet.class","

E:\\jar2\\org.eclipse.emf.ecore_2.9.1.v20130827-0309?(2).jar//org.eclipse.emf.ecore.resource.ResourceSet.class",

"E:\\jar2\\org.eclipse.emf.ecore_2.9.1.v20130827-0309?(3).jar//org.eclipse.emf.ecore.resource.ResourceSet.class",

"E:\\jar2\\org.eclipse.emf.ecore_2.9.1.v20130827-0309.jar//org.eclipse.emf.ecore.resource.ResourceSet.class","

E:\\jar2\\sdk-common.jar//com.android.ide.common.res2.ResourceSet.class"]

--f

?

3.?要使用的jar

Elcipse哈面兒的emf,gef,uml關鍵字的jar

?

作者::?綽號:老哇的爪子?(?全名::Attilax?akbar?al?rapanui?阿提拉克斯?阿克巴?阿爾?拉帕努伊?)?漢字名:艾龍,??EMAIL:1466519819@qq.com

轉載請注明來源:?http://blog.csdn.net/attilax

?

4.?矢量繪圖系統?java

5.?JpGraph?3.0.7

JpGraph專門提供圖表的類庫。它使得作圖變成了一件非常簡單的事情,你只需從數據庫中取出相關數據,定義標題,圖表類型,然后的事情就交給JpGraph,只需掌握為數不多的JpGraph內置函數(可以參照JpGraph附帶例子學習),就可以畫出非常炫目的圖表!

?

?

?

?

Graphical?Editor?Framework?(GEF)
???????GEF允許開發者使用已有的應用模型簡便的開發出一個圖形化編輯器。GEF可以使開發者快速的將現有的模型移植到一個圖形化編輯的環境中。這個圖形化環境是基于SWT的繪圖插件“draw2d”GEF是基于MVC框架的,他可以使開發者方便的實現drop/dragundo/redomovedeleteresize等圖形編輯器的基本功能。GEF非常適合用于開發流程編輯器、GUI?BuilderUML圖編輯器、workflow編輯器、甚至是像html這種所見即所得的文本編輯器。但是需要注意的是GEF開發的軟件必須工作與Eclipse環境下,即作為plug-in程序,如果希望脫離Eclipse平臺作為獨立軟件運行,可以參考Eclipse?3系列正在開發的rich?client?platformRCP)。結合GEFRCP就可以開發出運行與Eclipse平臺外的圖形編輯器。
?????

EMF(Eclipse?Model?Framework)
??????Eclipse?Modeling?Framework旨在提供一種簡便設計和實現結構化模型的框架,emf提供代碼生成工具以使得開發者可以把精力集中在模型本身而不是它的實現細節上,這個框架根本的概念是:元數據(meta-data),代碼生成(code?generation),默認序列化(dafault?serialization
??????emf項目的最初目的是實現omgObject?Management?Group)的一個元對象工具。同時emfEcilpse系列工具目前對mda的部分實現。
??????emf可以用于描述和建立模型,在這些定義的基礎上java?code可以被自動生成,這些實現的模型則可以被作為任何java程序開發的基礎。這就是emf所要解決的問題。
??????目前為止emf只是mda部分實現,所以它不包括用于混合xml,eai,ejbs,web?services等技術的企業級應用所需的map

?

EMFEclipse?Modelling?Framework)是Eclipse?MDAModel?Driven?Architecture)的重要組成部分,可以將模型轉換成高效的,正確的,易于定制的Java代碼。

GMF(Graphical?Modeling?Framework?)

The?Eclipse?Graphical?Modeling?Framework?(GMF)?provides?a?generative?component?and?runtime?infrastructure?for?developing?graphical?editors?based?on?EMF?and?GEF.

?

?

GEF,?全稱:?Graphical?Editor?Framework,?一套圖像編輯框架,?用于開發圖形應用,?如果你在Eclipse中使用過基于圖形設計的應用,?例如UML建模,?可視化軟件界面設計(VE),?它們基本上都基于GEF而開發出來的.

大部分GEF應用都EMF合作完成的,?EMF可以生成圖形模型和源代碼,?通過建立規則來對圖形應用進行約束,?使其簡化了開發....?但由于畢竟GEFEMF兩個獨立的項目,?他們之間冗余的東西也不少,?因此Eclipse人為了使它們更好地應用到程序中,?開發了GMF(Graphical?Modeling?Framework)框架,?這個在The?Eclipse?Technology?Project中可以找到.?

?

6.?Code

package?umlPrj;

?

import?java.io.IOException;

?

import?org.eclipse.emf.ecore.resource.Resource;

import?org.eclipse.emf.ecore.resource.ResourceSet;

import?org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;

import?org.eclipse.uml2.uml.LiteralUnlimitedNatural;

import?org.eclipse.uml2.uml.Model;

import?org.eclipse.uml2.uml.PrimitiveType;

import?org.eclipse.uml2.uml.Property;

import?org.eclipse.uml2.uml.Type;

import?org.eclipse.uml2.uml.UMLFactory;

import?org.eclipse.uml2.uml.resource.UMLResource;

import?org.eclipse.uml2.uml.resources.util.UMLResourcesUtil;

import?org.eclipse.emf.common.util.URI;

?

public?class?umlTest?{

?

public?static?void?main(String[]?args)?{

?

Model?epo2Model?=?createModel("epo2");

?

org.eclipse.uml2.uml.Package?barPackage?=?UMLFactory.eINSTANCE

.createPackage();

//?PrimitiveType?intPrimitiveType?=?createPrimitiveType(epo2Model,

//?"int");

org.eclipse.uml2.uml.Class?supplierClass?=?createClass(epo2Model,

"Supplier",?false);

//?createAttribute(supplierClass,?"name",?PrimitiveType,?0,?1);

?String?fileExtension?=?UMLResource.FILE_EXTENSION;//zosh?.uml

String?f?=?"";//args[0];

f="attilaxUmlOutputFolder";

save(epo2Model,?URI.createFileURI(f).appendSegment("UmlFileMainname").appendFileExtension(fileExtension));?

?

}

?

protected?static?Model?createModel(String?name)?{

Model?model?=?UMLFactory.eINSTANCE.createModel();

model.setName(name);

?

out("Model?'"?+?model.getQualifiedName()?+?"'?created.");

?

return?model;

}

?

private?static?void?out(String?string)?{

System.out.println(string);

?

}

?

protected?static?org.eclipse.uml2.uml.Package?createPackage(

org.eclipse.uml2.uml.Package?nestingPackage,?String?name)?{

org.eclipse.uml2.uml.Package?package_?=?nestingPackage

.createNestedPackage(name);

?

out("Package?'"?+?package_.getQualifiedName()?+?"'?created.");

?

return?package_;

}

?

protected?static?PrimitiveType?createPrimitiveType(

org.eclipse.uml2.uml.Package?package_,?String?name)?{

PrimitiveType?primitiveType?=?(PrimitiveType)?package_

.createOwnedPrimitiveType(name);

?

out("Primitive?type?'"?+?primitiveType.getQualifiedName()

+?"'?created.");

?

return?primitiveType;

}

?

protected?static?org.eclipse.uml2.uml.Class?createClass(

org.eclipse.uml2.uml.Package?package_,?String?name,

boolean?isAbstract)?{

org.eclipse.uml2.uml.Class?class_?=?package_.createOwnedClass(name,

isAbstract);

?

out("Class?'"?+?class_.getQualifiedName()?+?"'?created.");

?

return?class_;

}

?

protected?static?Property?createAttribute(

org.eclipse.uml2.uml.Class?class_,?String?name,?Type?type,

int?lowerBound,?int?upperBound)?{

Property?attribute?=?class_.createOwnedAttribute(name,?type,

lowerBound,?upperBound);

?

out("Attribute?'%s'?:?%s?[%s..%s]?created.",?//

attribute.getQualifiedName(),?//?attribute?name

type.getQualifiedName(),?//?type?name

lowerBound,?//?no?special?case?for?multiplicity?lower?bound

(upperBound?==?LiteralUnlimitedNatural.UNLIMITED)???"*"?//?special

//?case

//?for

//?unlimited

//?bound

:?upperBound);

?

return?attribute;

}

?

private?static?void?out(String?string,?String?qualifiedName,

String?qualifiedName2,?int?lowerBound,?Object?object)?{

//?TODO?Auto-generated?method?stub

?

}

?

protected?static?void?save(org.eclipse.uml2.uml.Package?package_,?URI?uri)?{

//?Create?a?resource-set?to?contain?the?resource(s)?that?we?are?saving

ResourceSet?resourceSet?=?new?ResourceSetImpl();

?

//?Initialize?registrations?of?resource?factories,?library?models,

//?profiles,?Ecore?metadata,?and?other?dependencies?required?for

//?serializing?and?working?with?UML?resources.?This?is?only?necessary?in

//?applications?that?are?not?hosted?in?the?Eclipse?platform?run-time,?in

//?which?case?these?registrations?are?discovered?automatically?from

//?Eclipse?extension?points.

UMLResourcesUtil.init(resourceSet);

?

//?Create?the?output?resource?and?add?our?model?package?to?it.

?

Resource?resource?=?resourceSet.createResource(uri);

resource.getContents().add(package_);

?

//?And?save

try?{

resource.save(null);?//?no?save?options?needed

out("Done.");

}?catch?(IOException?ioe)?{

throw?new?RuntimeException(ioe);

}

}

?

private?static?void?err(String?message)?{

//?TODO?Auto-generated?method?stub

?

}

}

?

7.?Ref

?

MDT?UML2?Getting?Started?with?UML2及我自己的一些理解?-?xiaogugood的專欄?-?博客頻道?-?CSDN.NET.htm

使用?UML?API?編輯?UML?循序圖.htm

使用?UML?API?編輯?UML?序列圖.htm

MDT?UML2?Getting?Started?with?UML2?-?Eclipsepedia.htm

UML建模工具開發實踐_圖文_百度文庫.htm

?

轉載于:https://www.cnblogs.com/attilax/p/5963568.html

版权声明:本站所有资料均为网友推荐收集整理而来,仅供学习和研究交流使用。

原文链接:https://hbdhgg.com/1/192283.html

发表评论:

本站为非赢利网站,部分文章来源或改编自互联网及其他公众平台,主要目的在于分享信息,版权归原作者所有,内容仅供读者参考,如有侵权请联系我们删除!

Copyright © 2022 匯編語言學習筆記 Inc. 保留所有权利。

底部版权信息