Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: marcinderylo/surveys-flex2java
base: 21c6efe850
...
head fork: marcinderylo/surveys-flex2java
compare: d7490735a5
  • 2 commits
  • 7 files changed
  • 0 commit comments
  • 1 contributor
View
86 ...or/src/main/java/org/adaptiveplatform/codegenerator/Java2FlexGeneratorFlexMojoRunner.java
@@ -17,51 +17,51 @@
@Component(role = org.sonatype.flexmojos.generator.Generator.class, hint = "adaptiveCodeGenerator")
public class Java2FlexGeneratorFlexMojoRunner implements Generator {
- private final Logger logger = LoggerFactory.getLogger(Java2FlexGeneratorFlexMojoRunner.class);
+ private final Logger logger = LoggerFactory.getLogger(Java2FlexGeneratorFlexMojoRunner.class);
- private static final String TRANSLATE_PACKAGES_EXTRA_OPTION = "translatePackages";
+ private static final String TRANSLATE_PACKAGES_EXTRA_OPTION = "translatePackages";
- public void generate(GenerationRequest request) throws GenerationException {
- Java2FlexCodeGeneratorConfiguration configuration = new Java2FlexCodeGeneratorConfiguration();
- configuration.translatePackages(loadPropertiesMap(request.getExtraOptions()
- .get(TRANSLATE_PACKAGES_EXTRA_OPTION)));
- configuration.addConstrainAnnotationsPackage("org.adaptiveplatform");
- configuration.configureFreemarkerTemplatingEngine("/", ".ftl");
- configuration.configureFileExporter(request.getPersistentOutputFolder(), request.getTransientOutputFolder());
- Java2FlexCodeGenerator generator = configuration.build();
- generator.generate(loadClasses(request.getClasses().keySet(), request.getClassLoader()));
- }
+ public void generate(GenerationRequest request) throws GenerationException {
+ Java2FlexCodeGeneratorConfiguration configuration = new Java2FlexCodeGeneratorConfiguration();
+ configuration.translatePackages(loadPropertiesMap(request.getExtraOptions()
+ .get(TRANSLATE_PACKAGES_EXTRA_OPTION)));
+ configuration.addConstrainAnnotationsPackage("org.adaptiveplatform");
+ configuration.configureFreemarkerTemplatingEngine("/", ".ftl");
+ configuration.configureFileExporter(request.getPersistentOutputFolder(), request.getTransientOutputFolder());
+ Java2FlexCodeGenerator generator = configuration.build();
+ generator.generate(loadClasses(request.getClasses().keySet(), request.getClassLoader()));
+ }
- private Set<Class<?>> loadClasses(Set<String> classesStrings, ClassLoader classLoader) {
- Set<Class<?>> classes = new HashSet<Class<?>>();
- for (String classString : classesStrings) {
- try {
- classes.add(classLoader.loadClass(classString));
- } catch (ClassNotFoundException e) {
- logger.warn("Class not found: " + classString);
- }
- }
- return classes;
- }
+ private Set<Class<?>> loadClasses(Set<String> classesStrings, ClassLoader classLoader) {
+ Set<Class<?>> classes = new HashSet<Class<?>>();
+ for (String classString : classesStrings) {
+ try {
+ classes.add(classLoader.loadClass(classString));
+ } catch (ClassNotFoundException e) {
+ logger.warn("Class not found: " + classString);
+ }
+ }
+ return classes;
+ }
- private Map<String, String> loadPropertiesMap(String string) throws GenerationException {
- Properties properties = new Properties();
- try {
- properties.load(new StringReader(string));
- Map<String, String> map = new HashMap<String, String>();
- for (Map.Entry<Object, Object> entry : properties.entrySet()) {
- map.put(toTrimmedString(entry.getKey()), toTrimmedString(entry.getValue()));
- }
- return map;
- } catch (IOException cause) {
- throw new GenerationException("cannot parse extra option: " + TRANSLATE_PACKAGES_EXTRA_OPTION, cause);
- }
- }
+ private Map<String, String> loadPropertiesMap(String string) throws GenerationException {
+ Properties properties = new Properties();
+ try {
+ properties.load(new StringReader(string));
+ Map<String, String> map = new HashMap<String, String>();
+ for (Map.Entry<Object, Object> entry : properties.entrySet()) {
+ map.put(toTrimmedString(entry.getKey()), toTrimmedString(entry.getValue()));
+ }
+ return map;
+ } catch (IOException cause) {
+ throw new GenerationException("cannot parse extra option: " + TRANSLATE_PACKAGES_EXTRA_OPTION, cause);
+ }
+ }
- private String toTrimmedString(Object value) {
- if (value == null) {
- return null;
- }
- return value.toString().trim();
- }
-}
+ private String toTrimmedString(Object value) {
+ if (value == null) {
+ return null;
+ }
+ return value.toString().trim();
+ }
+}
View
99 flex2java-flex/src/main/flex/org/adaptiveplatform/communication/AsyncTokenResultHandler.as
@@ -1,47 +1,52 @@
-package org.adaptiveplatform.communication {
- import mx.rpc.AsyncResponder;
- import mx.rpc.AsyncToken;
- import mx.rpc.events.FaultEvent;
- import mx.rpc.events.ResultEvent;
-
- public class AsyncTokenResultHandler implements ResultHandler {
- private var token:AsyncToken;
-
- public function AsyncTokenResultHandler(token:AsyncToken) {
- this.token=token;
- }
-
- public function onSuccess(success:Function):ResultHandler {
- token.addResponder(new AsyncResponder( //
- function(event:ResultEvent, token:Object=null):void {
- success(event.result);
- }, function(event:FaultEvent, token:Object=null):void {
- // do nothing
- }));
- return this;
- }
-
- public function onFault(fault:Function):ResultHandler {
- token.addResponder(new AsyncResponder( //
- function(event:ResultEvent, token:Object=null):void {
- // do nothing
- }, function(event:FaultEvent, token:Object=null):void {
- fault(event.fault);
- }));
- return this;
- }
-
-
- public function onError(error:String, fault:Function):ResultHandler {
- token.addResponder(new AsyncResponder( //
- function(event:ResultEvent, token:Object=null):void {
- // do nothing
- }, function(event:FaultEvent, token:Object=null):void {
- if (event.fault.faultCode == error) {
- fault(event.fault);
- }
- }));
- return this;
- }
- }
-}
+package org.adaptiveplatform.communication {
+ import mx.rpc.AsyncResponder;
+ import mx.rpc.AsyncToken;
+ import mx.rpc.events.FaultEvent;
+ import mx.rpc.events.ResultEvent;
+
+ public class AsyncTokenResultHandler implements ResultHandler {
+ private var token:AsyncToken;
+
+ public function AsyncTokenResultHandler(token:AsyncToken) {
+ this.token=token;
+ }
+
+ public function onSuccess(success:Function):ResultHandler {
+ token.addResponder(new AsyncResponder( //
+ function(event:ResultEvent, token:Object=null):void {
+ success(event.result);
+ }, function(event:FaultEvent, token:Object=null):void {
+ // do nothing
+ }));
+ return this;
+ }
+
+ public function onFault(fault:Function):ResultHandler {
+ token.addResponder(new AsyncResponder( //
+ function(event:ResultEvent, token:Object=null):void {
+ // do nothing
+ }, function(event:FaultEvent, token:Object=null):void {
+ fault(event.fault);
+ }));
+ return this;
+ }
+
+
+ public function onError(error:String, fault:Function):ResultHandler {
+ token.addResponder(new AsyncResponder( //
+ function(event:ResultEvent, token:Object=null):void {
+ // do nothing
+ }, function(event:FaultEvent, token:Object=null):void {
+ if (event.fault.faultCode == error) {
+ fault(event.fault);
+ }
+ }));
+ return this;
+ }
+
+ public function addListener(onSuccess:Function, onFailure:Function):ResultHandler {
+ token.addResponder(new AsyncResponder(onSuccess, onFailure));
+ return this;
+ }
+ }
+}
View
67 flex2java-flex/src/main/flex/org/adaptiveplatform/communication/FaultResultHandler.as
@@ -1,34 +1,33 @@
-package org.adaptiveplatform.communication {
- import mx.rpc.Fault;
-
- public class FaultResultHandler implements ResultHandler {
- private var faultReason:Fault;
-
- public function FaultResultHandler(code:String, string:String, detail:String=null, ... arguments) {
- this.faultReason=new Fault(code, string, detail);
- }
-
- public function onSuccess(success:Function):ResultHandler {
- // do nothing
- return this;
- }
-
- public function onFault(fault:Function):ResultHandler {
- fault(faultReason);
- return this;
- }
-
- public function onError(error:String, fault:Function):ResultHandler {
- // LATER create new Fault class to handle error messages
- if (error == faultReason.faultCode) {
- fault(faultReason);
- }
- return this;
- }
-
- public function onSuccessGoto(view:String):ResultHandler {
- // do nothing
- return this;
- }
- }
-}
+package org.adaptiveplatform.communication {
+ import mx.rpc.Fault;
+
+ public class FaultResultHandler implements ResultHandler {
+ private var faultReason:Fault;
+
+ public function FaultResultHandler(code:String, string:String, detail:String=null, ... arguments) {
+ this.faultReason=new Fault(code, string, detail);
+ }
+
+ public function onSuccess(success:Function):ResultHandler {
+ // do nothing
+ return this;
+ }
+
+ public function onFault(fault:Function):ResultHandler {
+ fault(faultReason);
+ return this;
+ }
+
+ public function onError(error:String, fault:Function):ResultHandler {
+ // LATER create new Fault class to handle error messages
+ if (error == faultReason.faultCode) {
+ fault(faultReason);
+ }
+ return this;
+ }
+
+ public function addListener(onSuccess:Function, onFailure:Function):ResultHandler{
+ throw new Error("not yet implemented");
+ }
+ }
+}
View
92 flex2java-flex/src/main/flex/org/adaptiveplatform/communication/RemoteMethodResultHandler.as
@@ -1,43 +1,49 @@
-package org.adaptiveplatform.communication {
- import flash.events.Event;
-
- import mx.rpc.events.FaultEvent;
- import mx.rpc.events.ResultEvent;
- import mx.rpc.remoting.RemoteObject;
-
- public class RemoteMethodResultHandler implements ResultHandler {
-
- private var remoteMethod:RemoteObject;
-
- public function RemoteMethodResultHandler(remoteMethod:RemoteObject) {
- this.remoteMethod=remoteMethod;
- }
-
- public function onSuccess(success:Function):ResultHandler {
- remoteMethod.addEventListener(ResultEvent.RESULT, function(event:ResultEvent):void {
- if (success.length == 0) {
- success();
- } else {
- success(event.result);
- }
- });
- return this;
- }
-
- public function onFault(fault:Function):ResultHandler {
- remoteMethod.addEventListener(FaultEvent.FAULT, function(event:FaultEvent):void {
- fault(event.fault);
- });
- return this;
- }
-
- public function onError(error:String, fault:Function):ResultHandler {
- remoteMethod.addEventListener(FaultEvent.FAULT, function(event:FaultEvent):void {
- if (event.fault.faultCode == error) {
- fault(event.fault);
- }
- });
- return this;
- }
- }
-}
+package org.adaptiveplatform.communication {
+ import flash.events.Event;
+
+ import mx.rpc.events.FaultEvent;
+ import mx.rpc.events.ResultEvent;
+ import mx.rpc.remoting.RemoteObject;
+
+ public class RemoteMethodResultHandler implements ResultHandler {
+
+ private var remoteMethod:RemoteObject;
+
+ public function RemoteMethodResultHandler(remoteMethod:RemoteObject) {
+ this.remoteMethod=remoteMethod;
+ }
+
+ public function onSuccess(success:Function):ResultHandler {
+ remoteMethod.addEventListener(ResultEvent.RESULT, function(event:ResultEvent):void {
+ if (success.length == 0) {
+ success();
+ } else {
+ success(event.result);
+ }
+ });
+ return this;
+ }
+
+ public function onFault(fault:Function):ResultHandler {
+ remoteMethod.addEventListener(FaultEvent.FAULT, function(event:FaultEvent):void {
+ fault(event.fault);
+ });
+ return this;
+ }
+
+ public function onError(error:String, fault:Function):ResultHandler {
+ remoteMethod.addEventListener(FaultEvent.FAULT, function(event:FaultEvent):void {
+ if (event.fault.faultCode == error) {
+ fault(event.fault);
+ }
+ });
+ return this;
+ }
+
+ public function addListener(onSuccess:Function, onFailure:Function):ResultHandler {
+ remoteMethod.addEventListener(ResultEvent.RESULT, onSuccess);
+ remoteMethod.addEventListener(FaultEvent.FAULT, onFailure);
+ return this;
+ }
+ }
+}
View
19 flex2java-flex/src/main/flex/org/adaptiveplatform/communication/ResultHandler.as
@@ -1,9 +1,10 @@
-package org.adaptiveplatform.communication {
- import mx.resources.ResourceManager;
-
- public interface ResultHandler {
- function onSuccess(success:Function):ResultHandler;
- function onFault(fault:Function):ResultHandler;
- function onError(error:String, fault:Function):ResultHandler;
- }
-}
+package org.adaptiveplatform.communication {
+ import mx.resources.ResourceManager;
+
+ public interface ResultHandler {
+ function onSuccess(success:Function):ResultHandler;
+ function onFault(fault:Function):ResultHandler;
+ function onError(error:String, fault:Function):ResultHandler;
+ function addListener(onSuccess:Function, onFailure:Function):ResultHandler;
+ }
+}
View
110 flex2java-flex/src/main/flex/org/adaptiveplatform/communication/SuccessResultHandler.as
@@ -1,53 +1,57 @@
-package org.adaptiveplatform.communication {
- import mx.collections.ArrayCollection;
- import mx.rpc.Fault;
-
- public class SuccessResultHandler implements ResultHandler {
- private var result:Object;
-
- private var faultHandlers:ArrayCollection=new ArrayCollection();
- private var faultHappened:Boolean=false;
- private var fault:Fault;
-
- public function SuccessResultHandler(result:Object=null) {
- this.result=result;
- }
-
- public function onSuccess(success:Function):ResultHandler {
- try {
- if (success.length == 0) {
- success();
- } else {
- success(result);
- }
- } catch (error:Error) {
- faultHappened=true;
- fault=new Fault("" + error.errorID, "" + error.name, "" + error.message);
- for each (var faultHandler:Function in faultHandlers) {
- faultHandler(fault);
- }
- }
- return this;
- }
-
- public function onFault(faultHandler:Function):ResultHandler {
- if (faultHappened) {
- faultHandler(fault);
- } else {
- faultHandlers.addItem(faultHandler);
- }
- return this;
- }
-
- public function onError(error:String, faultHandler:Function):ResultHandler {
- if (faultHappened) {
- if(fault.faultCode==error){
- faultHandler(fault);
- }
- } else {
- faultHandlers.addItem(faultHandler);
- }
- return this;
- }
- }
-}
+package org.adaptiveplatform.communication {
+ import mx.collections.ArrayCollection;
+ import mx.rpc.Fault;
+
+ public class SuccessResultHandler implements ResultHandler {
+ private var result:Object;
+
+ private var faultHandlers:ArrayCollection=new ArrayCollection();
+ private var faultHappened:Boolean=false;
+ private var fault:Fault;
+
+ public function SuccessResultHandler(result:Object=null) {
+ this.result=result;
+ }
+
+ public function onSuccess(success:Function):ResultHandler {
+ try {
+ if (success.length == 0) {
+ success();
+ } else {
+ success(result);
+ }
+ } catch (error:Error) {
+ faultHappened=true;
+ fault=new Fault("" + error.errorID, "" + error.name, "" + error.message);
+ for each (var faultHandler:Function in faultHandlers) {
+ faultHandler(fault);
+ }
+ }
+ return this;
+ }
+
+ public function onFault(faultHandler:Function):ResultHandler {
+ if (faultHappened) {
+ faultHandler(fault);
+ } else {
+ faultHandlers.addItem(faultHandler);
+ }
+ return this;
+ }
+
+ public function onError(error:String, faultHandler:Function):ResultHandler {
+ if (faultHappened) {
+ if(fault.faultCode==error){
+ faultHandler(fault);
+ }
+ } else {
+ faultHandlers.addItem(faultHandler);
+ }
+ return this;
+ }
+
+ public function addListener(onSuccess:Function, onFailure:Function):ResultHandler {
+ throw new Error("not yet implemented");
+ }
+ }
+}
View
95 pom.xml
@@ -15,7 +15,7 @@
<properties>
<flexsdk.version>3.5.0.12683</flexsdk.version>
- <flexmojos.version>4.2-beta</flexmojos.version>
+ <flexmojos.version>4.2-beta</flexmojos.version>
</properties>
<build>
@@ -105,59 +105,40 @@
</dependencies>
</dependencyManagement>
- <repositories>
- <repository>
- <id>central</id>
- <url>http://repo2.maven.org/maven2</url>
- </repository>
- <repository>
- <id>org.springframework.maven.milestone</id>
- <url>http://maven.springframework.org/milestone </url>
- </repository>
- <repository>
- <id>org.springsource.maven.snapshot</id>
- <url>http://maven.springframework.org/snapshot</url>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
- </repository>
- <repository>
- <id>sonatype-flexmojos</id>
- <url>https://repository.sonatype.org/service/local/repositories/flexmojos-releases/content</url>
- <releases />
- <snapshots />
- </repository>
- <repository>
- <id>sonatype-flex</id>
- <url>https://repository.sonatype.org/service/local/repositories/flex/content</url>
- <releases />
- <snapshots />
- </repository>
- <repository>
- <id>JBoss</id>
- <url>http://repository.jboss.org/nexus/content/groups/public-jboss/</url>
- </repository>
- <repository>
- <id>codehaus</id>
- <url>http://repository.codehaus.org</url>
- </repository>
- <repository>
- <id>adapt</id>
- <url>http://svn2.xp-dev.com/svn/adapt-m2repo</url>
- </repository>
- </repositories>
- <pluginRepositories>
- <pluginRepository>
- <id>sonatype-flexmojos</id>
- <url>https://repository.sonatype.org/service/local/repositories/flexmojos-releases/content</url>
- <releases />
- <snapshots />
- </pluginRepository>
- <pluginRepository>
- <id>sonatype-flex</id>
- <url>https://repository.sonatype.org/service/local/repositories/flex/content</url>
- <releases />
- <snapshots />
- </pluginRepository>
- </pluginRepositories>
-</project>
+ <repositories>
+ <repository>
+ <id>central</id>
+ <url>http://repo2.maven.org/maven2</url>
+ </repository>
+ <repository>
+ <id>org.springframework.maven.milestone</id>
+ <url>http://maven.springframework.org/milestone </url>
+ </repository>
+ <repository>
+ <id>JBoss</id>
+ <url>http://repository.jboss.com/maven2</url>
+ </repository>
+ <repository>
+ <id>adapt</id>
+ <url>http://svn2.xp-dev.com/svn/adapt-m2repo</url>
+ </repository>
+ <repository>
+ <id>sonatype-flexmojos</id>
+ <url>http://repository.sonatype.org/content/groups/flexgroup/</url>
+ </repository>
+ <repository>
+ <id>sonatype-flexmojos2</id>
+ <url>https://repository.sonatype.org/service/local/repositories/flexmojos-releases/content</url>
+ </repository>
+ <repository>
+ <id>sonatype-flex</id>
+ <url>https://repository.sonatype.org/service/local/repositories/flex/content</url>
+ </repository>
+ </repositories>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>sonatype-flexmojos</id>
+ <url>https://repository.sonatype.org/service/local/repositories/flexmojos-releases/content</url>
+ </pluginRepository>
+ </pluginRepositories>
+</project>

No commit comments for this range

Something went wrong with that request. Please try again.