[jboss-cvs] jbosside/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/module ...

Robert Stryker rawblem at gmail.com
Thu Jan 4 17:41:19 EST 2007


  User: rawb    
  Date: 07/01/04 17:41:19

  Modified:    as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/module  
                        JBossModuleFactory.java PathModuleFactory.java
  Log:
  Initialization of module factories needed to be refactored because, well, it didnt work. ;)   Initialization was being done too many times, and in the case of path factories, not at all. 
  
  Revision  Changes    Path
  1.3       +15 -11    jbosside/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/module/JBossModuleFactory.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: JBossModuleFactory.java
  ===================================================================
  RCS file: /cvsroot/jboss/jbosside/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/module/JBossModuleFactory.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -b -r1.2 -r1.3
  --- JBossModuleFactory.java	10 Nov 2006 04:28:01 -0000	1.2
  +++ JBossModuleFactory.java	4 Jan 2007 22:41:19 -0000	1.3
  @@ -57,9 +57,6 @@
   	protected HashMap moduleToDelegate = null;
   	
   	public JBossModuleFactory() {
  -		pathToModule = new HashMap();
  -		moduleToDelegate = new HashMap();
  -		initialize();
   	}
   	
   	public abstract void initialize();
  @@ -96,17 +93,22 @@
   	 * and are expected. 
   	 */
   	protected void cacheModules() {
  -		this.pathToModule = new HashMap();
  -		this.moduleToDelegate = new HashMap();
   		
   		String[] paths = getServerModulePaths();
  +		if( paths != null ) {
  +			this.pathToModule = new HashMap();
  +			this.moduleToDelegate = new HashMap();
   		for( int i = 0; i < paths.length; i++ ) {
   			acceptAddition(paths[i]);
   		}
   	}
  +	}
   	
   	// lifted from other class
   	private String[] getServerModulePaths() {
  +		String factId = getFactoryId();
  +		if( factId == null ) return null;
  +		
   		// Stolen from Server.class, not public
   		final String MODULE_LIST = "modules";
   
  @@ -140,11 +142,10 @@
   						moduleId = moduleId.substring(0, index);
   					}
   					
  -					if( moduleId.startsWith(getFactoryId() + ":")) {
  -						String path = moduleId.substring((getFactoryId()+":").length());
  +					if( moduleId.startsWith(factId + ":")) {
  +						String path = moduleId.substring((factId+":").length());
   						paths.add(path);
   					}
  -					
   				}
   			}
   		}
  @@ -186,7 +187,10 @@
   	 * @return
   	 */
   	public String getFactoryId() {
  +		try {
   		return getId();
  +		} catch( NullPointerException npe ) {}
  +		return null;
   	}
   	
   	protected abstract IModule acceptAddition(String path);
  
  
  
  1.2       +1 -0      jbosside/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/module/PathModuleFactory.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: PathModuleFactory.java
  ===================================================================
  RCS file: /cvsroot/jboss/jbosside/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/module/PathModuleFactory.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- PathModuleFactory.java	10 Nov 2006 04:28:01 -0000	1.1
  +++ PathModuleFactory.java	4 Jan 2007 22:41:19 -0000	1.2
  @@ -49,6 +49,7 @@
   	}
   	
   	public void initialize() {
  +		cacheModules();
   	}
   
   	protected IModule acceptAddition(String path) {
  
  
  



More information about the jboss-cvs-commits mailing list