[jbpm-cvs] jbpm.3/designer/jpdl/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/util ...

Koen Aers <[email protected]> Fri, 20 Feb 2009 01:35:19 -0500
Newsgroups gmane.comp.jbpm.cvs
Message-ID <[email protected]>
  User: kaers   
  Date: 09/02/20 01:35:19

  Modified:    designer/jpdl/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/util 
                        Tag: branch_jbpm_jpdl_gpd_3_1_x
                        ProcessDeployer.java
  Log:
  deployment of inner classes
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.4.1   +31 -0     jbpm.3/designer/jpdl/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/util/Attic/ProcessDeployer.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ProcessDeployer.java
  ===================================================================
  RCS file: /cvsroot/jbpm/jbpm.3/designer/jpdl/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/util/Attic/ProcessDeployer.java,v
  retrieving revision 1.1
  retrieving revision 1.1.4.1
  diff -u -b -r1.1 -r1.1.4.1
  --- ProcessDeployer.java	19 Jul 2007 19:18:49 -0000	1.1
  +++ ProcessDeployer.java	20 Feb 2009 06:35:19 -0000	1.1.4.1
  @@ -4,10 +4,13 @@
   import java.io.DataOutputStream;
   import java.io.File;
   import java.io.FileOutputStream;
  +import java.io.FilenameFilter;
   import java.io.IOException;
   import java.io.InputStream;
  +import java.net.Authenticator;
   import java.net.ConnectException;
   import java.net.MalformedURLException;
  +import java.net.PasswordAuthentication;
   import java.net.URL;
   import java.net.URLClassLoader;
   import java.net.URLConnection;
  @@ -192,6 +195,11 @@
   	}
   
   	private void deployProcessWithServlet(byte[] parBytes) throws Exception {
  +		Authenticator.setDefault(new Authenticator() {
  +		    protected PasswordAuthentication getPasswordAuthentication() {
  +		    	return new PasswordAuthentication("user", "user".toCharArray());
  +		    }
  +		});
   		URL url = new URL("http://" + serverName + ":" + serverPort + serverDeployer);
   		URLConnection urlConnection = url.openConnection();
   		urlConnection.setDoInput(true);
  @@ -273,6 +281,28 @@
   		while ((read = is.read(buff)) != -1) {
   			zos.write(buff, 0, read);
   		}
  +		is.close();
  +		if (classOrResource.endsWith(".class")) {
  +			final String className = 
  +				classOrResource.substring(classOrResource.lastIndexOf('/') + 1, classOrResource.length() - 6) + '$';
  +			URL url = loader.getResource(classOrResource);
  +			File file = new File(url.getFile());
  +			File folder = new File(file.getParent());
  +			String nestedClasses[] = folder.list(new FilenameFilter() {
  +				public boolean accept(File dir, String name) {
  +					return name.startsWith(className);
  +				}
  +			});
  +			for (int i = 0; i < nestedClasses.length; i++) {
  +				String fileName = classOrResource.substring(0, classOrResource.lastIndexOf("/") + 1) + nestedClasses[i];
  +				zos.putNextEntry(new ZipEntry("classes/" + fileName));
  +				is = loader.getResourceAsStream(fileName);
  +				while ((read = is.read(buff)) != -1) {
  +					zos.write(buff, 0, read);
  +				}
  +				is.close();
  +			}
  +		}
   	}
   
   	private void addFile(ZipOutputStream zos, String fileName)
  @@ -299,4 +329,5 @@
   		}
   		return urls;
   	}
  +	
   }
  
  
  

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H