Permalink
Browse files

new distributed pattern and several bug fixes (#1000)

* fixed a bug in object factory related to package import

* fixed a bug in scanning the generated code

* fixed object factory's problem with user defined constructors

* rmi initiation moved to object factory

Another distributed pattern added

* full build

Web service RPC  added(compiles but not running)
some modifications to RPC
* fixing construcor name for distributed classes with name change
* fix distributed test to delete the files
  • Loading branch information...
1 parent f54347c commit 84d0a268bc935b3fdb97719667078009cd7e9846 @amidzak amidzak committed on GitHub Feb 17, 2017
Showing with 912 additions and 491 deletions.
  1. +28 −14 UmpleToJava/UmpleTLTemplates/JavaClassGenerator.ump
  2. +372 −241 UmpleToJava/UmpleTLTemplates/JavaObjectFactoryClassGenerator.ump
  3. +49 −7 UmpleToJava/UmpleTLTemplates/JavaObjectFactoryInterfaceGenerator.ump
  4. +19 −8 UmpleToJava/UmpleTLTemplates/class_MethodDeclaration.ump
  5. +5 −20 UmpleToJava/UmpleTLTemplates/constructor_DeclareDefault.ump
  6. +3 −32 UmpleToJava/UmpleTLTemplates/constructor_DeclareOneToOne.ump
  7. +0 −1 UmpleToJava/UmpleTLTemplates/objectFactory_add_DeclareDefault.ump
  8. +0 −1 UmpleToJava/UmpleTLTemplates/objectFactory_add_DeclareOneToOne.ump
  9. +62 −3 UmpleToJava/UmpleTLTemplates/objectFactory_add_Declare_All.ump
  10. +47 −11 UmpleToJava/UmpleTLTemplates/rmi_objectFactory_add_methods.ump
  11. +73 −0 UmpleToJava/UmpleTLTemplates/rmi_objectFactory_add_methods1.ump
  12. +199 −85 cruise.umple/src/Generator_CodeJava.ump
  13. +1 −0 cruise.umple/src/Umple.ump
  14. +18 −16 cruise.umple/src/UmpleInternalParser_CodeClass.ump
  15. +4 −0 cruise.umple/src/UmpleInternalParser_CodeCore.ump
  16. +1 −1 cruise.umple/src/umple_core.grammar
  17. +14 −45 cruise.umple/test/cruise/umple/implementation/DistributedClassTest.java
  18. +9 −0 cruise.umple/test/cruise/umple/implementation/TemplateTest.java
  19. +1 −1 cruise.umple/test/cruise/umple/implementation/java/Class_DistributableRMI.java.txt
  20. +0 −1 cruise.umple/test/cruise/umple/implementation/java/Class_DistributableRMI.ump
  21. +1 −1 cruise.umple/test/cruise/umple/implementation/java/Class_DistributableRMI3_proxy.java.txt
  22. +2 −0 cruise.umple/test/cruise/umple/implementation/java/Class_DistributableRMI5.ump
  23. +1 −0 cruise.umple/test/cruise/umple/implementation/java/Class_DistributableRMI5_parent.java.txt
  24. +1 −1 cruise.umple/test/cruise/umple/implementation/java/Class_DistributableRMI_directives1.ump
  25. +1 −1 cruise.umple/test/cruise/umple/implementation/java/Class_DistributableRMI_directives2.ump
  26. +1 −1 cruise.umple/test/cruise/umple/implementation/java/Class_DistributableRMI_directives3.ump
@@ -95,15 +95,26 @@ class JavaClassGenerator {
<<# } #>>
public <<# if (uClass.getIsAbstract()) { append(realSb, "{0} ", "abstract"); } #>>class <<=uClass.getName()>><<= gen.translate("isA",uClass) >><<#
boolean hasParentInterface=uClass.hasParentInterface();
-if(uClass.getHasProxyPattern())
+
+if(uClass.getNeedsDefaultInterface())
{
if (hasParentInterface == false){
- append(realSb," implements I"+uClass.getName());
+ if(model.getDistributePattern()==0)
+ append(realSb," implements java.io.Serializable");
+ else if(model.getDistributePattern()==1&&uClass.getIsDistributed())
+ append(realSb," implements java.io.Serializable , I"+uClass.getName());
+ else if(model.getDistributePattern()==2)
+ append(realSb," implements java.io.Serializable ,I"+uClass.getName().substring(0,uClass.getName().length()-4));
hasParentInterface=true;
}
else{
if(uClass.getNeedsDefaultInterface())
- append(realSb,", I"+uClass.getName());
+ if(model.getDistributePattern()==0)
+ append(realSb," ,java.io.Serializable");
+ else if(model.getDistributePattern()==1&&uClass.getIsDistributed())
+ append(realSb," ,java.io.Serializable , I"+uClass.getName());
+ else if(model.getDistributePattern()==2)
+ append(realSb," ,java.io.Serializable ,I"+uClass.getName().substring(0,uClass.getName().length()-4));
}
}
@@ -148,7 +159,7 @@ for (StateMachine smq : uClass.getStateMachines())
return realSb;
}
private String getDistributedMethodsCode(StringBuilder realSb, UmpleModel model,UmpleClass uClass)
- {if(uClass.getHasProxyPattern()){#>>
+ {if(uClass.getHasProxyPattern()||uClass.getIsDistributed()){#>>
//------------------------
// Returning the Hashcode
//------------------------
@@ -160,24 +171,24 @@ for (StateMachine smq : uClass.getStateMachines())
}return realSb.toString();
}
private String getProxyReferenceCode(StringBuilder realSb, UmpleModel model,UmpleClass uClass)
- {if(uClass.getHasProxyPattern()){#>>
+ {if(uClass.getIsDistributed()&&model.getDistributePattern()==1){#>>
//------------------------
// Reference to the proxy
//------------------------
- <<=uClass.getName().substring(0,uClass.getName().length()-4)>> realSelf;
+ <<=uClass.getName().substring(0,uClass.getName().length()-4)>> self;
- public void setRealSelf(<<=uClass.getName().substring(0,uClass.getName().length()-4)>> self)
+ public void setSelf(<<=uClass.getName().substring(0,uClass.getName().length()-4)>> proxy)
{
- realSelf=self;
+ self=proxy;
}
<<#}return realSb.toString();
}
private String getMemberCode(StringBuilder realSb, UmpleModel model,UmpleClass uClass, GeneratedClass gClass, JavaGenerator gen, boolean isFirst)
{
String self="this";
- if(uClass.getHasProxyPattern())
- self="realSelf";
+ if(uClass.getIsDistributed()&&model.getDistributePattern()==1)
+ self="self";
#>><<@ UmpleToJava.members_AllStatics >><<@ UmpleToJava.members_AllAttributes >><<@ UmpleToJava.members_AllStateMachines >><<@ UmpleToJava.members_AllDoActivities >><<@ UmpleToJava.members_AllAssociations >><<@ UmpleToJava.members_AllHelpers >>
<<#return realSb.toString();
}
@@ -215,8 +226,10 @@ for (StateMachine smq : uClass.getStateMachines())
}
private String getAssociationCode(StringBuilder realSb, UmpleModel model,UmpleClass uClass, GeneratedClass gClass, JavaGenerator gen, boolean isFirst, boolean isFake)
{ String self="this";
- if(uClass.getHasProxyPattern())
- self="realSelf";
+
+ if(uClass.getIsDistributed()&&model.getDistributePattern()==1)
+ self="self";
+
String umpleSourceFile = "";
Integer baseJavaLine = realSb.toString().split("\\n").length+3;#>><<@ UmpleToJava.association_Get_All >><<@ UmpleToJava.association_Set_All >>
<<#return realSb.toString();
@@ -235,8 +248,9 @@ for (StateMachine smq : uClass.getStateMachines())
private String getDeleteCode(StringBuilder realSb, UmpleModel model,UmpleClass uClass, GeneratedClass gClass, JavaGenerator gen, boolean isFirst, boolean isFake)
{
String self="this";
- if(uClass.getHasProxyPattern())
- self="realSelf";
+ if(uClass.getIsDistributed()&&model.getDistributePattern()==1)
+ self="self";
+
Integer baseJavaLine = realSb.toString().split("\\n").length+1; #>><<@ UmpleToJava.delete_All >>
<<# for (StateMachine smq : uClass.getStateMachines())
{
Oops, something went wrong.

0 comments on commit 84d0a26

Please sign in to comment.