Changeset 3363


Ignore:
Timestamp:
08/12/13 12:34:39 (11 years ago)
Author:
g.georgovassilis@mpi.nl
Message:
 
Location:
ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui
Files:
1 added
10 edited

Legend:

Unmodified
Added
Removed
  • ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/pom.xml

    r2616 r3363  
    124124            </plugin>
    125125        </plugins>
     126        <pluginManagement>
     127                <plugins>
     128                        <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
     129                        <plugin>
     130                                <groupId>org.eclipse.m2e</groupId>
     131                                <artifactId>lifecycle-mapping</artifactId>
     132                                <version>1.0.0</version>
     133                                <configuration>
     134                                        <lifecycleMappingMetadata>
     135                                                <pluginExecutions>
     136                                                        <pluginExecution>
     137                                                                <pluginExecutionFilter>
     138                                                                        <groupId>
     139                                                                                org.sonatype.flexmojos
     140                                                                        </groupId>
     141                                                                        <artifactId>
     142                                                                                flexmojos-maven-plugin
     143                                                                        </artifactId>
     144                                                                        <versionRange>
     145                                                                                [3.9,)
     146                                                                        </versionRange>
     147                                                                        <goals>
     148                                                                                <goal>compile-swf</goal>
     149                                                                                <goal>test-compile</goal>
     150                                                                        </goals>
     151                                                                </pluginExecutionFilter>
     152                                                                <action>
     153                                                                        <ignore></ignore>
     154                                                                </action>
     155                                                        </pluginExecution>
     156                                                </pluginExecutions>
     157                                        </lifecycleMappingMetadata>
     158                                </configuration>
     159                        </plugin>
     160                </plugins>
     161        </pluginManagement>
    126162    </build>
    127163
  • ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/services/BrowserService.as

    r3131 r3363  
    11package clarin.cmdi.componentregistry.services {
    2         import clarin.cmdi.componentregistry.common.ItemDescription;
     2        import com.adobe.net.URI;
    33       
    4         import com.adobe.net.URI;       
    5         import mx.collections.ArrayCollection; 
    6         import mx.rpc.events.ResultEvent;
     4        import mx.collections.ArrayCollection;
     5       
     6        import clarin.cmdi.componentregistry.common.ItemDescription;   
    77       
    88        public class BrowserService extends ComponentRegistryService {
     
    1515                public var itemDescriptions:ArrayCollection;
    1616
    17                 // Not bindable needed for lookups over the whole collections of itemDescriptions
    18                 protected var userSpace:Boolean;
    19 
    20                 public function BrowserService(restUrl:String, userSpace:Boolean) {
    21                         super(restUrl);
     17                public function BrowserService(successEvent:String, restUrl:URI, userSpace:Boolean) {
     18                        super(successEvent, restUrl);
    2219                        this.userSpace = userSpace;
    2320                }
    2421               
    25                 override protected function initServiceUrl(url:URI):void{
     22                override protected function dispatchRequest(url:URI):void {
    2623                        if (userSpace) {
    2724                                url.setQueryValue(Config.PARAM_USERSPACE, "true");
    2825                        }
     26                        super.dispatchRequest(url);
    2927                }
    3028               
    31                 /**
    32                  * Override in concrete subclasses
    33                  */
    34                 override protected function result(resultEvent:ResultEvent):void {
    35                 }
    36 
    37                
    38                                
    3929                public function findDescription(id:String):ItemDescription {                   
    4030                        for each (var item:ItemDescription in itemDescriptions) {
  • ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/services/CommentListService.as

    r1896 r3363  
    11package clarin.cmdi.componentregistry.services {
    2         import clarin.cmdi.componentregistry.common.Comment;
    3         import clarin.cmdi.componentregistry.common.ItemDescription;
    4        
    52        import com.adobe.net.URI;
    63       
    74        import mx.collections.ArrayCollection;
    8         import mx.rpc.events.ResultEvent;
     5       
     6        import clarin.cmdi.componentregistry.common.Comment;
     7        import clarin.cmdi.componentregistry.common.ItemDescription;
    98       
    109        [Event(name="CommentsLoaded", type="flash.events.Event")]
    1110        public class CommentListService extends ComponentRegistryService {
    1211                public static const COMMENTS_LOADED:String = "CommentsLoaded";
    13                 ;
    14                 private var userSpace:Boolean;
    1512                private var itemDescription:ItemDescription;
    1613               
     
    2926                                url = Config.instance.getComponentCommentsPath(itemDescription.id);
    3027                        }
    31                         super(url);
     28                        super(COMMENTS_LOADED, new URI(url));
    3229                       
    3330                        this.itemDescription = itemDescription;
     
    3532                }
    3633               
    37                 override protected function initServiceUrl(url:URI):void{
    38                         if (userSpace) {
    39                                 url.setQueryValue(Config.PARAM_USERSPACE, "true");
    40                         }
    41                 }
    42                
    43                 override protected function result(resultEvent:ResultEvent):void {
    44                         var resultXml:XML = resultEvent.result as XML;
     34                override protected function handleXmlResult(resultXml:XML):void{
    4535                        var nodes:XMLList = resultXml.comment;
    4636                       
     
    5242                        }
    5343                        comments.refresh();
    54                         dispatchEvent(new Event(COMMENTS_LOADED));
    5544                }
    5645        }
  • ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/services/ComponentInfoService.as

    r1375 r3363  
    11package clarin.cmdi.componentregistry.services {
    22
     3        import com.adobe.net.URI;
     4       
    35        import clarin.cmdi.componentregistry.common.Component;
    46        import clarin.cmdi.componentregistry.common.ComponentMD;
    57        import clarin.cmdi.componentregistry.common.ItemDescription;
    68       
    7         import com.adobe.net.URI;
    89       
    9         import flash.events.Event;
    10         import flash.events.EventDispatcher;
    11        
    12         import mx.controls.Alert;
    13         import mx.messaging.messages.HTTPRequestMessage;
    14         import mx.rpc.AsyncToken;
    15         import mx.rpc.Responder;
    16         import mx.rpc.events.FaultEvent;
    17         import mx.rpc.events.ResultEvent;
    18         import mx.rpc.http.HTTPService;
    19         import mx.utils.StringUtil;
    20 
    2110        [Event(name="ComponentLoaded", type="flash.events.Event")]
    22         public class ComponentInfoService extends EventDispatcher{
    23                 public static const COMPONENT_LOADED:String = "ComponentLoaded";
    24 
    25                 private var service:HTTPService;
     11        public class ComponentInfoService extends BaseRemoteService{
     12               
     13                public static const COMPONENT_LOADED:String="ComponentLoaded";
    2614
    2715                [Bindable]
    2816                public var component:Component;
    2917
    30 
    3118                public function ComponentInfoService() {
    32                         this.service = new HTTPService();
    33                         this.service.method = HTTPRequestMessage.GET_METHOD;
    34                         this.service.resultFormat = HTTPService.RESULT_FORMAT_E4X;
     19                        super(COMPONENT_LOADED);
    3520                }
    3621
     
    4227                                url.setQueryValue(Config.PARAM_USERSPACE, "true");
    4328                        }
    44                         service.url = url.toString();
    45                         var token:AsyncToken = this.service.send();
    46                         token.addResponder(new Responder(result, fault));
     29                        dispatchRequest(url);
    4730                }
    4831
    49                 private function result(resultEvent:ResultEvent):void {
    50                         var resultXml:XML = resultEvent.result as XML;
     32                override protected function handleXmlResult(resultXml:XML):void {
    5133                        var metaData:ComponentMD = new ComponentMD();
    5234                        metaData.name = resultXml.CMD_Component.@name;
    5335                        metaData.xml = resultXml;
    5436                        component.componentMD = metaData;
    55                         dispatchEvent(new Event(COMPONENT_LOADED));
    5637                }
    5738
    58                 public function fault(faultEvent:FaultEvent):void {
    59                         var errorMessage:String = StringUtil.substitute("Error in {0}: {1} - {2}", this, faultEvent.fault.faultString, faultEvent.fault.faultDetail);
    60                         Alert.show(errorMessage);
    61                 }
    6239        }
    6340}
  • ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/services/ComponentListService.as

    r3131 r3363  
    11package clarin.cmdi.componentregistry.services {
     2        import com.adobe.net.URI;
     3       
     4        import flash.events.Event;
     5       
     6        import mx.collections.ArrayCollection;
     7       
    28        import clarin.cmdi.componentregistry.browser.BrowserColumns;
    39        import clarin.cmdi.componentregistry.common.ItemDescription;
    4        
    5         import mx.collections.ArrayCollection;
    6         import mx.rpc.events.ResultEvent;
    7         import flash.events.Event;
    810       
    911        public class ComponentListService extends BrowserService {
     
    1214               
    1315                public function ComponentListService(userSpace:Boolean = false) {
    14                         super(Config.instance.componentListUrl, userSpace);
     16                        super(COMPONENTS_LOADED, new URI(Config.instance.componentListUrl), userSpace);
    1517                }
    1618               
    17                 override protected function result(resultEvent:ResultEvent):void {
    18                         var resultXml:XML = resultEvent.result as XML;
     19                override protected function handleXmlResult(resultXml:XML):void{
    1920                        var nodes:XMLList = resultXml.componentDescription;
    2021                       
  • ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/services/ComponentRegistryService.as

    r2525 r3363  
    33        import com.adobe.net.URI;
    44       
    5         import flash.events.Event;
    6         import flash.events.EventDispatcher;
    7        
    8         import mx.controls.Alert;
    9         import mx.messaging.messages.HTTPRequestMessage;
    10         import mx.rpc.AsyncToken;
    11         import mx.rpc.Responder;
    12         import mx.rpc.events.FaultEvent;
    13         import mx.rpc.events.ResultEvent;
    14         import mx.rpc.http.HTTPService;
    15         import mx.utils.StringUtil;
    16        
    17         public class ComponentRegistryService extends EventDispatcher {
    18                 private var service:HTTPService;
     5        public class ComponentRegistryService extends BaseRemoteService {
    196               
    20                 private var serviceUrl:String;
     7                protected var serviceUrl:URI;
     8                protected var userSpace:Boolean;
    219               
    22                 public function ComponentRegistryService(restUrl:String) {
    23                         this.serviceUrl = restUrl;
    24                         service = new HTTPService();
    25                         service.method = HTTPRequestMessage.GET_METHOD;
    26                         service.resultFormat = HTTPService.RESULT_FORMAT_E4X;
     10                public function ComponentRegistryService(successEvent:String, serviceUrl:URI) {
     11                        super(successEvent);
     12                        this.serviceUrl = serviceUrl;
    2713                }
    2814               
    29                 private function initService():void {
    30                         var url:URI = new URI(serviceUrl);
     15                override protected function dispatchRequest(url:URI):void {
    3116                        url.setQueryValue("unique", new Date().getTime().toString());
    32                         initServiceUrl(url);
    33                         service.url = url.toString();
     17                        if (userSpace) {
     18                                url.setQueryValue(Config.PARAM_USERSPACE, "true");
     19                        } else
     20                                url.setQueryValue(Config.PARAM_USERSPACE, null);
     21                        super.dispatchRequest(url);
    3422                }
    3523               
    3624                public function load():void {
    37                         initService();
    38                         var token:AsyncToken = this.service.send();
    39                         token.addResponder(new Responder(result, fault));
     25                        dispatchRequest(serviceUrl);
    4026                }
    4127               
    42                 /**
    43                  * Override in concrete subclasses
    44                  */
    45                 protected function result(resultEvent:ResultEvent):void {
    46                 }
    47                
    48                 public function fault(faultEvent:FaultEvent):void {
    49                         var errorMessage:String = StringUtil.substitute("Error in {0}: \n Fault: {1} - {2}", this, faultEvent.fault.faultString, faultEvent.fault.faultDetail);
    50                         trace(errorMessage);
    51                         Alert.show("Internal Server error cannot process the data, try reloading the application.");
    52                 }
    53                
    54                 protected function initServiceUrl(url:URI):void{
    55                 };
    5628        }
    5729}
  • ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/services/ElementTypesListService.as

    r2535 r3363  
    11package clarin.cmdi.componentregistry.services //trunk
    22{
    3     import flash.events.Event;
    4     import flash.events.MouseEvent;
     3   
     4    import com.adobe.net.URI;
    55   
    66    import mx.collections.ArrayCollection;
    7     import mx.rpc.events.ResultEvent;
    87       
    98        public class ElementTypesListService extends ComponentRegistryService
     
    1615                public function ElementTypesListService()
    1716                {
    18                   super(Config.getUriAllowedElementTypes());
     17                  super(ALLOWED_TYPES_LOADED, new URI(Config.getUriAllowedElementTypes()));
    1918                }
    2019               
    2120               
    22                 // called by load()
    23                 override protected function result(resultEvent:ResultEvent):void {
    24                         var resultXml:XML = resultEvent.result as XML;
     21                override protected function handleXmlResult(resultXml:XML):void{
    2522                        allowedTypes= new ArrayCollection();
    2623                        var currentValue:String;
     
    2926                                allowedTypes.addItem({label: currentValue, data: currentValue});
    3027                        }
    31                         dispatchEvent(new Event(ALLOWED_TYPES_LOADED));
    3228                }
    3329               
  • ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/services/PingSessionService.as

    r2515 r3363  
    11package clarin.cmdi.componentregistry.services {
    22
    3         import clarin.cmdi.componentregistry.common.Credentials;
     3        import com.adobe.net.URI;
    44       
    55        import flash.events.TimerEvent;
     
    1414        import mx.rpc.http.HTTPService;
    1515        import mx.utils.StringUtil;
     16       
     17        import clarin.cmdi.componentregistry.common.Credentials;
    1618
    1719
    18         public class PingSessionService {
     20        public class PingSessionService extends BaseRemoteService{
    1921
    2022                [Bindable]
     
    2426        private static const PING_INTERVAL:int = 1000 * 60 * 5; //5 minutes
    2527                private var timer:Timer = new Timer(PING_INTERVAL, 0);
    26                 private var service:HTTPService;
    2728
    2829                /**
     
    3031                 */
    3132                function PingSessionService() {
    32                         this.service = new HTTPService();
    33                         this.service.method = HTTPRequestMessage.GET_METHOD;
    34                         this.service.resultFormat = HTTPService.RESULT_FORMAT_E4X;
     33                        super("PingOk");
    3534                }
    3635
     
    4645                private function pingSession():void {
    4746                    if (Credentials.instance.isLoggedIn()) {
    48                         service.url = Config.instance.pingSessionUrl;
    49                         var token:AsyncToken = service.send();
    50                         token.addResponder(new Responder(result, fault));
     47                                dispatchRequest(new URI(Config.instance.pingSessionUrl));
    5148                    }
    5249                }
    5350
    54                 private function result(resultEvent:ResultEvent):void {
    55                         stillActive = resultEvent.result.@stillActive == "true";
     51                override protected function handleXmlResult(resultXml:XML):void{
     52                        stillActive = resultXml.@stillActive == "true";
    5653                        if (!stillActive) {
    5754                            Alert.show("Your session has expired, please reload the application to refresh the session.");
     
    6057                }
    6158
    62                 public function fault(faultEvent:FaultEvent):void {
     59                override protected function requestCallbackFailed(faultEvent:FaultEvent):void {
    6360                        timer.stop(); // We stop to bother the user with more errors. Somethings is wrong user needs probably to reload which will start the timer again.
    64                         var errorMessage:String = StringUtil.substitute("Error in {0}: {1} - {2}", this, faultEvent.fault.faultString, faultEvent.fault.faultDetail);
    65                         Alert.show(errorMessage);
     61                        super.requestCallbackFailed(faultEvent);
    6662                }
    6763        }
  • ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/services/ProfileInfoService.as

    r856 r3363  
    66        import com.adobe.net.URI;
    77
    8         import flash.events.Event;
    9         import flash.events.EventDispatcher;
    10 
    118        import mx.collections.ArrayCollection;
    12         import mx.controls.Alert;
    13         import mx.messaging.messages.HTTPRequestMessage;
    14         import mx.rpc.AsyncToken;
    15         import mx.rpc.Responder;
    16         import mx.rpc.events.FaultEvent;
    17         import mx.rpc.events.ResultEvent;
    18         import mx.rpc.http.HTTPService;
    19         import mx.utils.StringUtil;
    209
    2110        [Event(name="ProfileLoaded", type="flash.events.Event")]
    22         public class ProfileInfoService extends EventDispatcher {
     11        public class ProfileInfoService extends BaseRemoteService {
    2312                public static const PROFILE_LOADED:String = "ProfileLoaded";
    24 
    25                 private var service:HTTPService;
    2613
    2714                [Bindable]
    2815                public var profile:Profile;
    2916
    30 
    3117                public function ProfileInfoService() {
    32                         this.service = new HTTPService();
    33                         this.service.method = HTTPRequestMessage.GET_METHOD;
    34                         this.service.resultFormat = HTTPService.RESULT_FORMAT_E4X;
     18                        super(PROFILE_LOADED);
    3519                }
    3620
     
    4226                                url.setQueryValue(Config.PARAM_USERSPACE, "true");
    4327                        }
    44                         service.url = url.toString();
    45                         var token:AsyncToken = this.service.send();
    46                         token.addResponder(new Responder(result, fault));
     28                        super.dispatchRequest(url);
    4729                }
    48 
    49                 private function result(resultEvent:ResultEvent):void {
    50                         var resultXml:XML = resultEvent.result as XML;
     30               
     31                override protected function handleXmlResult(resultXml:XML):void{
    5132                        var nodes:XMLList = resultXml.CMD_Component;
    52 
     33                       
    5334                        profile.nrOfComponents = nodes.length();
    5435                        profile.profileSource = resultXml;
     
    6142                        }
    6243                        this.profile.components = new ArrayCollection(tempArray);
    63                         dispatchEvent(new Event(PROFILE_LOADED));
    64                 }
    65 
    66                 public function fault(faultEvent:FaultEvent):void {
    67                         var errorMessage:String = StringUtil.substitute("Error in {0}: {1} - {2}", this, faultEvent.fault.faultString, faultEvent.fault.faultDetail);
    68                         Alert.show(errorMessage);
    6944                }
    7045        }
  • ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/services/ProfileListService.as

    r3131 r3363  
    44       
    55        import mx.collections.ArrayCollection;
    6         import mx.rpc.events.ResultEvent;       
    7         import flash.events.Event;
     6        import com.adobe.net.URI;
    87       
    98       
     
    1312               
    1413                public function ProfileListService(userSpace:Boolean=false) {
    15                         super(Config.instance.profileListUrl, userSpace);
     14                        super(PROFILES_LOADED, new URI(Config.instance.profileListUrl), userSpace);
    1615                }
    1716               
    18                 override protected function result(resultEvent:ResultEvent):void {
    19                         var resultXml:XML = resultEvent.result as XML;
     17                override protected function handleXmlResult(resultXml:XML):void{
    2018                        var nodes:XMLList = resultXml.profileDescription;
    2119                        var tempArray:ArrayCollection = new ArrayCollection();
     
    2826                        tempArray.refresh();
    2927                        itemDescriptions = new ArrayCollection(tempArray.toArray());
    30                         trace(itemDescriptions.length);
    31                         dispatchEvent(new Event(this.PROFILES_LOADED));
    3228                }               
    3329        }
Note: See TracChangeset for help on using the changeset viewer.