It looks like you are leaving the work of the actual copy to WTP's PublishUtil 
class.

My understand of how this works inside WTP is that it does a file copy of each 
file to the directory 
$HOME/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp12345.class 
and then does a rename to the final deployment location (which WTP is expecting 
to be in a directory like 
$HOME/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/

If you check your directory 
$HOME/workspace/.metadata/.plugins/org.eclipse.wst.server.core/ both before and 
after your a publish with JBossTools-AS where your runtime is on another file 
system you should see left over files appear and the number of files in the 
directory grow.  It does not seem WTP deletes the old temporary after the 
renameTo() failed.

This works great for Tomcat and other such containers that can treat the "tmp1" 
directory above as a deployment directory but not do useful if the runtime it 
somewhere else.

Since all the built in WTP runtime tools I have seen use the "tmp1/" directory 
in the workspace area as the deployment area you can't expect these tools to 
work for deployment outside of the workspace area.


My suggestion would be for JBoss to open up an API request with the server 
tooling to allow the PublishUtil tool to be instanced and configured an exact 
path to be used as the temporary location to copy to.

File tmpDir = new File("/opt/jboss-4.2.1.GA/server/default/tmp/jbosside-as");
  | if(!tmpDir.getParent().exist() == false)
  |   throw new RuntimeException("Directory " + 
tmpDir.getParent().getAbsolutePath() + " does not exist");
  | tmpDir.mkdirs();
  | PublishUtil publishUtilInstance = new PublishUtil(tmpDir);
  | 
  | // Then in your code instead of using the static methods use the instanced 
ones
  | publishUtilInstance.callSomeMethod(someArgs);
  | 


So it looks like to me you need a way to pass down a temporary path that WTP 
standard methods can use as the temporary directory to perform the initial copy 
from the "project build area".  This is runtime specific.  Its also concerning 
that the rename must have failed and that no error is indicated in the UI so 
there is another area to look at in that.



What does this idiom "copied = copied &&" do ?

http://viewvc.jboss.org/cgi-bin/viewvc.cgi/jbosstools/trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/FileUtil.java?view=log
  | 
  | #fileSafeCopy(File src, File dest, IFileUtilListener listener) {
  |                             copied = copied && fileSafeCopy(subFiles, 
newDest, listener);
  | }
  | 
  | // I would think that propagation of an error would but more correct here :
  | 
  | if(fileSafeCopy(subFiles, newDest, listener) == false) {
  |  copied = false;
  | }

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4093910#4093910

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4093910
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to