Subversion Repository Public Repository

litesoft

Diff Revisions 626 vs 948 for /trunk/GWT_Sandbox/FormEngine/src/com/temp/client/foundation/pavment/ActivityFactoryRegistry.java

Diff revisions: vs.
  @@ -1,58 +1,51 @@
1 1 package com.temp.client.foundation.pavment;
2 2
3 - import java.util.HashMap;
4 - import java.util.Map;
3 + import com.google.gwt.place.shared.*;
5 4
6 - import com.google.gwt.place.shared.Place;
5 + import java.util.*;
7 6
8 - public class ActivityFactoryRegistry
9 - {
10 - public static <CommonActivityParam extends CommonActivityParameter, ViewImpl extends View, APlace extends Place> void register( ActivityFactory.Synchronous<CommonActivityParam, ViewImpl, APlace> pFactory )
11 - {
7 + public class ActivityFactoryRegistry {
8 + public static <CommonActivityParam extends CommonActivityParameter, ViewImpl extends View, APlace extends Place> void register(
9 + ActivityFactory.Synchronous<CommonActivityParam, ViewImpl, APlace> pFactory ) {
12 10 add( pFactory );
13 11 }
14 12
15 - public static <CommonActivityParam extends CommonActivityParameter, ViewImpl extends View, APlace extends Place> void register( ActivityFactory.Asynchronous<CommonActivityParam, ViewImpl, APlace> pFactory )
16 - {
13 + public static <CommonActivityParam extends CommonActivityParameter, ViewImpl extends View, APlace extends Place> void register(
14 + ActivityFactory.Asynchronous<CommonActivityParam, ViewImpl, APlace> pFactory ) {
17 15 add( pFactory );
18 16 }
19 17
20 18 private static final Map<String, ActivityFactory> PLACEID2ACTIVITYFACTORIES = new HashMap<String, ActivityFactory>();
21 19
22 - protected static synchronized ActivityFactory get( String pPlaceId )
23 - {
20 + protected static synchronized ActivityFactory get( String pPlaceId ) {
24 21 return PLACEID2ACTIVITYFACTORIES.get( pPlaceId );
25 22 }
26 23
27 24 @SuppressWarnings("rawtypes")
28 - protected static synchronized boolean replace( ActivityFactory.Asynchronous pExistingFactory, ActivityFactory pNewSyncFactory )
29 - {
30 - if ( pNewSyncFactory != null )
31 - {
25 + protected static synchronized boolean replace( ActivityFactory.Asynchronous pExistingFactory, ActivityFactory pNewSyncFactory ) {
26 + if ( pNewSyncFactory != null ) {
32 27 String zPlaceId = pNewSyncFactory.getPlaceId();
33 - if ( !pExistingFactory.getPlaceId().equals( zPlaceId ) )
34 - {
28 + if ( !pExistingFactory.getPlaceId().equals( zPlaceId ) ) {
35 29 throw new IllegalStateException( "New Sync Factory for '" + zPlaceId + "', not '" + pExistingFactory.getPlaceId() + "'" );
36 30 }
37 31 ActivityFactory zPreviousFactory = PLACEID2ACTIVITYFACTORIES.put( zPlaceId, pNewSyncFactory );
38 - if ( pExistingFactory != zPreviousFactory )
39 - {
40 - throw new IllegalStateException( "Existing Async Factory (" + pExistingFactory.getClass() + ") already replaced by (" + zPreviousFactory.getClass() + ") for: " + zPlaceId );
32 + if ( pExistingFactory != zPreviousFactory ) {
33 + throw new IllegalStateException(
34 + "Existing Async Factory (" + pExistingFactory.getClass() + ") already replaced by (" + zPreviousFactory.getClass() + ") for: " +
35 + zPlaceId );
41 36 }
42 37 return true;
43 38 }
44 39 return false;
45 40 }
46 41
47 - private static synchronized void add( ActivityFactory pFactory )
48 - {
49 - if ( pFactory != null )
50 - {
42 + private static synchronized void add( ActivityFactory pFactory ) {
43 + if ( pFactory != null ) {
51 44 String zPlaceId = pFactory.getPlaceId();
52 45 ActivityFactory zPreviousFactory = PLACEID2ACTIVITYFACTORIES.put( zPlaceId, pFactory );
53 - if ( (zPreviousFactory != null) && (zPreviousFactory == pFactory) )
54 - {
55 - throw new IllegalStateException( "Duplicate registration for '" + zPlaceId + "', previous (" + zPreviousFactory.getClass() + "), new (" + pFactory.getClass() + ")" );
46 + if ( (zPreviousFactory != null) && (zPreviousFactory == pFactory) ) {
47 + throw new IllegalStateException(
48 + "Duplicate registration for '" + zPlaceId + "', previous (" + zPreviousFactory.getClass() + "), new (" + pFactory.getClass() + ")" );
56 49 }
57 50 }
58 51 }