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

Robert Stryker rawblem at gmail.com
Tue Nov 14 14:30:41 EST 2006


  User: rawb    
  Date: 06/11/14 14:30:41

  Modified:    as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server 
                        JBossServer.java
  Log:
  made it actually work instead of sit disconnected and broken. 
  
  Revision  Changes    Path
  1.16      +36 -20    jbosside/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/JBossServer.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: JBossServer.java
  ===================================================================
  RCS file: /cvsroot/jboss/jbosside/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/JBossServer.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -b -r1.15 -r1.16
  --- JBossServer.java	10 Nov 2006 00:26:25 -0000	1.15
  +++ JBossServer.java	14 Nov 2006 19:30:41 -0000	1.16
  @@ -38,6 +38,8 @@
   import org.eclipse.wst.server.core.internal.Server;
   import org.eclipse.wst.server.core.model.ServerDelegate;
   import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
  +import org.jboss.ide.eclipse.as.core.model.DescriptorModel;
  +import org.jboss.ide.eclipse.as.core.model.DescriptorModel.ServerDescriptorModel;
   import org.jboss.ide.eclipse.as.core.runtime.IJBossServerLaunchDefaults;
   import org.jboss.ide.eclipse.as.core.runtime.IJBossServerRuntime;
   import org.jboss.ide.eclipse.as.core.runtime.server.ServerLaunchDefaults;
  @@ -116,20 +118,38 @@
   	
   	
   	
  -	// TODO: PUT SOMEWHERE ELSE
  +	public String getConfigDirectory() {
  +		return getConfigDirectory(true);
  +	}
   	public String getDeployDirectory() {
  -		String deployDir = getLaunchConfigDeployDir();
  -		if( deployDir == null )  
  -			return getRuntimeDeployDirectory();
  +		return getDeployDirectory(true);
  +	}
  +
  +	public ServerDescriptorModel getDescriptorModel() {
  +		String configPath = getConfigDirectory();
  +		return DescriptorModel.getDefault().getServerModel(new Path(configPath));
  +	}
   
  -		File f = new File(deployDir);
  +	public String getConfigDirectory(boolean checkLaunchConfig) {
  +		if( !checkLaunchConfig ) 
  +			return getRuntimeConfigDirectory();
  +		
  +		String configDir = getLaunchConfigConfigurationDirectory();
  +		if( configDir == null )  
  +			return getRuntimeConfigDirectory();
  +
  +		File f = new File(configDir);
   		if( !f.exists() || !f.canRead() || !f.isDirectory())
  -			return getRuntimeDeployDirectory();
  +			return getRuntimeConfigDirectory();
   
  -		return deployDir;
  +		return configDir;
   	}
   	
  -	protected String getLaunchConfigDeployDir() {
  +	public String getDeployDirectory(boolean checkLaunchConfig) {
  +		return getConfigDirectory(checkLaunchConfig) + Path.SEPARATOR + DEPLOY;
  +	}
  +
  +	protected String getLaunchConfigConfigurationDirectory() {
   		try {
   			Server s = (Server)getServer();
   			ILaunchConfiguration lc = s.getLaunchConfiguration(true, new NullProgressMonitor());
  @@ -138,32 +158,28 @@
   			Map map = ArgsUtil.getSystemProperties(startArgs);
   			
   			if( map.get(JBOSS_SERVER_HOME_DIR) != null ) 
  -				return (String)map.get(JBOSS_SERVER_HOME_DIR) + Path.SEPARATOR + DEPLOY;
  +				return (String)map.get(JBOSS_SERVER_HOME_DIR);
   
   			if( map.get(JBOSS_SERVER_BASE_DIR) != null ) {
   				String name = map.get(JBOSS_SERVER_NAME) != null ? 
   						(String)map.get(JBOSS_SERVER_NAME) : DEFAULT_SERVER_NAME;
  -				return (String)map.get(JBOSS_SERVER_BASE_DIR) + Path.SEPARATOR + name + Path.SEPARATOR + DEPLOY;
  +				return (String)map.get(JBOSS_SERVER_BASE_DIR) + Path.SEPARATOR + name;
   			}
   			
   			if( map.get(JBOSS_HOME_DIR) != null ) {
   				return (String)map.get(JBOSS_HOME_DIR) + Path.SEPARATOR + SERVER 
  -					+ Path.SEPARATOR + DEFAULT_SERVER_NAME + Path.SEPARATOR + DEPLOY;
  +					+ Path.SEPARATOR + DEFAULT_SERVER_NAME;
   			}
  -
  -			return null;
   		} catch( CoreException ce ) {
  -			return null;
   		}
  +		return null;
   	}
   	
  -	// The deploy directory of the configuration in the runtime
  -	protected String getRuntimeDeployDirectory() {
  +	protected String getRuntimeConfigDirectory() {
   		IJBossServerRuntime runtime = (IJBossServerRuntime)
   		getServer().getRuntime().loadAdapter(IJBossServerRuntime.class, null);
  -
   		return getServer().getRuntime().getLocation().toOSString() + Path.SEPARATOR + "server" + 
  -		Path.SEPARATOR + runtime.getJBossConfiguration() + Path.SEPARATOR + "deploy";
  +			Path.SEPARATOR + runtime.getJBossConfiguration();
   	}
   	
   }
  \ No newline at end of file
  
  
  



More information about the jboss-cvs-commits mailing list