JBoss Tools SVN: r18178 - trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/process.
by jbosstools-commits@lists.jboss.org
Author: vyemialyanchyk
Date: 2009-10-20 09:48:00 -0400 (Tue, 20 Oct 2009)
New Revision: 18178
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/process/AllEntitiesProcessor.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4328 - fix unit tests
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/process/AllEntitiesProcessor.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/process/AllEntitiesProcessor.java 2009-10-20 13:47:26 UTC (rev 18177)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/process/AllEntitiesProcessor.java 2009-10-20 13:48:00 UTC (rev 18178)
@@ -12,7 +12,6 @@
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
@@ -28,7 +27,9 @@
import org.eclipse.jdt.core.dom.AST;
import org.eclipse.jdt.core.dom.rewrite.ASTRewrite;
import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
+import org.eclipse.text.edits.MalformedTreeException;
import org.hibernate.eclipse.console.HibernateConsolePlugin;
import org.hibernate.eclipse.jdt.ui.Activator;
import org.hibernate.eclipse.jdt.ui.internal.jpa.common.EntityInfo;
@@ -238,19 +239,24 @@
protected void performCommit(final Map<String, EntityInfo> entities,
ITextFileBufferManager bufferManager) {
- HashSet<IPath> paths = new HashSet<IPath>();
for (int i = 0; i < changes.size(); i++) {
ChangeStructure cs = changes.get(i);
- paths.add(cs.path);
- }
- Iterator<IPath> it = paths.iterator();
- while (it.hasNext()) {
- ITextFileBuffer textFileBuffer = bufferManager.getTextFileBuffer(it.next(), LocationKind.IFILE);
- try {
- // commit changes to underlying file
- textFileBuffer.commit(null, true);
- } catch (CoreException e) {
- HibernateConsolePlugin.getDefault().logErrorMessage("CoreException: ", e); //$NON-NLS-1$
+ if (cs.textEdit != null && ((cs.change != null && cs.change.isEnabled()) || (cs.change == null))) {
+ ITextFileBuffer textFileBuffer = bufferManager.getTextFileBuffer(cs.path, LocationKind.IFILE);
+ IDocument document = textFileBuffer.getDocument();
+ try {
+ cs.textEdit.apply(document);
+ } catch (MalformedTreeException e) {
+ HibernateConsolePlugin.getDefault().logErrorMessage("MalformedTreeException: ", e); //$NON-NLS-1$
+ } catch (BadLocationException e) {
+ HibernateConsolePlugin.getDefault().logErrorMessage("BadLocationException: ", e); //$NON-NLS-1$
+ }
+ try {
+ // commit changes to underlying file
+ textFileBuffer.commit(null, true);
+ } catch (CoreException e) {
+ HibernateConsolePlugin.getDefault().logErrorMessage("CoreException: ", e); //$NON-NLS-1$
+ }
}
}
}
14 years, 8 months
JBoss Tools SVN: r18177 - branches/jbosstools-3.1.0.M4/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/process.
by jbosstools-commits@lists.jboss.org
Author: vyemialyanchyk
Date: 2009-10-20 09:47:26 -0400 (Tue, 20 Oct 2009)
New Revision: 18177
Modified:
branches/jbosstools-3.1.0.M4/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/process/AllEntitiesProcessor.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4328 - fix unit tests
Modified: branches/jbosstools-3.1.0.M4/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/process/AllEntitiesProcessor.java
===================================================================
--- branches/jbosstools-3.1.0.M4/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/process/AllEntitiesProcessor.java 2009-10-20 06:39:40 UTC (rev 18176)
+++ branches/jbosstools-3.1.0.M4/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/process/AllEntitiesProcessor.java 2009-10-20 13:47:26 UTC (rev 18177)
@@ -12,7 +12,6 @@
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
@@ -28,7 +27,9 @@
import org.eclipse.jdt.core.dom.AST;
import org.eclipse.jdt.core.dom.rewrite.ASTRewrite;
import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
+import org.eclipse.text.edits.MalformedTreeException;
import org.hibernate.eclipse.console.HibernateConsolePlugin;
import org.hibernate.eclipse.jdt.ui.Activator;
import org.hibernate.eclipse.jdt.ui.internal.jpa.common.EntityInfo;
@@ -238,19 +239,24 @@
protected void performCommit(final Map<String, EntityInfo> entities,
ITextFileBufferManager bufferManager) {
- HashSet<IPath> paths = new HashSet<IPath>();
for (int i = 0; i < changes.size(); i++) {
ChangeStructure cs = changes.get(i);
- paths.add(cs.path);
- }
- Iterator<IPath> it = paths.iterator();
- while (it.hasNext()) {
- ITextFileBuffer textFileBuffer = bufferManager.getTextFileBuffer(it.next(), LocationKind.IFILE);
- try {
- // commit changes to underlying file
- textFileBuffer.commit(null, true);
- } catch (CoreException e) {
- HibernateConsolePlugin.getDefault().logErrorMessage("CoreException: ", e); //$NON-NLS-1$
+ if (cs.textEdit != null && ((cs.change != null && cs.change.isEnabled()) || (cs.change == null))) {
+ ITextFileBuffer textFileBuffer = bufferManager.getTextFileBuffer(cs.path, LocationKind.IFILE);
+ IDocument document = textFileBuffer.getDocument();
+ try {
+ cs.textEdit.apply(document);
+ } catch (MalformedTreeException e) {
+ HibernateConsolePlugin.getDefault().logErrorMessage("MalformedTreeException: ", e); //$NON-NLS-1$
+ } catch (BadLocationException e) {
+ HibernateConsolePlugin.getDefault().logErrorMessage("BadLocationException: ", e); //$NON-NLS-1$
+ }
+ try {
+ // commit changes to underlying file
+ textFileBuffer.commit(null, true);
+ } catch (CoreException e) {
+ HibernateConsolePlugin.getDefault().logErrorMessage("CoreException: ", e); //$NON-NLS-1$
+ }
}
}
}
14 years, 8 months
JBoss Tools SVN: r18176 - trunk/bpel/plugins/org.eclipse.bpel.model/src/org/eclipse/bpel/model/resource.
by jbosstools-commits@lists.jboss.org
Author: Grid.Qian
Date: 2009-10-20 02:39:40 -0400 (Tue, 20 Oct 2009)
New Revision: 18176
Modified:
trunk/bpel/plugins/org.eclipse.bpel.model/src/org/eclipse/bpel/model/resource/BPELResourceSetImpl.java
Log:
JBIDE-4953: can't load a wsdl file from a url
Modified: trunk/bpel/plugins/org.eclipse.bpel.model/src/org/eclipse/bpel/model/resource/BPELResourceSetImpl.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.model/src/org/eclipse/bpel/model/resource/BPELResourceSetImpl.java 2009-10-20 03:57:27 UTC (rev 18175)
+++ trunk/bpel/plugins/org.eclipse.bpel.model/src/org/eclipse/bpel/model/resource/BPELResourceSetImpl.java 2009-10-20 06:39:40 UTC (rev 18176)
@@ -19,72 +19,71 @@
import org.eclipse.core.resources.IResourceChangeEvent;
import org.eclipse.core.resources.IResourceChangeListener;
import org.eclipse.core.resources.IResourceDelta;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.URIConverter;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
-
/**
* @author Michal Chmielewski (michal.chmielewski(a)oracle.com)
* @date Apr 17, 2007
- *
+ *
*/
-
@SuppressWarnings("nls")
+public class BPELResourceSetImpl extends ResourceSetImpl implements
+ IResourceChangeListener {
-public class BPELResourceSetImpl extends ResourceSetImpl implements IResourceChangeListener {
-
public BPELResourceSetImpl() {
super();
// FIX ME: This should not have dependency on running eclipse.
// IWorkspace workspace = ResourcesPlugin.getWorkspace();
- // workspace.addResourceChangeListener(this, IResourceChangeEvent.POST_BUILD);
+ // workspace.addResourceChangeListener(this,
+ // IResourceChangeEvent.POST_BUILD);
}
/**
* Used to force loading using the right resource loaders.
*/
static public final String SLIGHTLY_HACKED_KEY = "slightly.hacked.resource.set";
-
-
-
+
/**
* Load the resource from the resource set, assuming that it is the kind
- * indicated by the last argument. The "kind" parameter is the extension
+ * indicated by the last argument. The "kind" parameter is the extension
* without the . of the resource.
*
- * This forces the right resource to be loaded even if the URI of the resource
- * is "wrong".
+ * This forces the right resource to be loaded even if the URI of the
+ * resource is "wrong".
*
- * @param uri the URI of the resource.
- * @param loadOnDemand load on demand
- * @param kind the resource kind. It has to be of the form "*.wsdl", or "*.xsd", or "*.bpel"
- * @return the loaded resource.
+ * @param uri
+ * the URI of the resource.
+ * @param loadOnDemand
+ * load on demand
+ * @param kind
+ * the resource kind. It has to be of the form "*.wsdl", or
+ * "*.xsd", or "*.bpel"
+ * @return the loaded resource.
*/
-
+
@SuppressWarnings("nls")
- public Resource getResource(URI uri, boolean loadOnDemand, String kind) {
+ public Resource getResource(URI uri, boolean loadOnDemand, String kind) {
Map<URI, Resource> map = getURIResourceMap();
-
+
if (map != null) {
Resource resource = map.get(uri);
if (resource != null) {
if (loadOnDemand && !resource.isLoaded()) {
demandLoadHelper(resource);
}
-
+
return resource;
}
}
URIConverter theURIConverter = getURIConverter();
URI normalizedURI = theURIConverter.normalize(uri);
-
+
for (Resource resource : getResources()) {
if (theURIConverter.normalize(resource.getURI()).equals(
normalizedURI)) {
@@ -96,11 +95,17 @@
map.put(uri, resource);
}
return resource;
- }
+ }
}
-
+
if (loadOnDemand) {
- Resource resource = demandCreateResource(uri,kind);
+ Resource resource = null;
+ if (!uri.toString().endsWith("?wsdl")) {
+ resource = demandCreateResource(uri, kind);
+ } else {
+ resource = this.createResource(URI.createURI("*.wsdl"));
+ resource.setURI(uri);
+ }
if (resource == null) {
throw new RuntimeException("Cannot create a resource for '"
+ uri + "'; a registered resource factory is needed");
@@ -116,122 +121,123 @@
return null;
}
-
-
- protected Resource demandCreateResource ( URI uri, String kind ) {
- return createResource ( uri, kind );
+
+ protected Resource demandCreateResource(URI uri, String kind) {
+ return createResource(uri, kind);
}
-
-
+
/**
* Create the resource based on the kind.
+ *
* @param uri
* @param kind
* @return the created resource
*/
-
- // TODO: ganymede [ this method apparently is already in the parent resource set ]
+
+ // TODO: ganymede [ this method apparently is already in the parent resource
+ // set ]
// we can strike it from this resourceset.
-
-// @SuppressWarnings("nls")
-// public Resource createResource ( URI uri, String kind) {
-//
-// if (kind == null) {
-// return super.createResource(uri);
-// }
-//
-// Resource resource = createResource(URI.createURI("*." + kind));
-// resource.setURI(uri);
-// return resource;
-// }
+ // @SuppressWarnings("nls")
+ // public Resource createResource ( URI uri, String kind) {
+ //
+ // if (kind == null) {
+ // return super.createResource(uri);
+ // }
+ //
+ // Resource resource = createResource(URI.createURI("*." + kind));
+ // resource.setURI(uri);
+ // return resource;
+ // }
-
-
-
-
/**
* @see org.eclipse.core.resources.IResourceChangeListener#resourceChanged(org.eclipse.core.resources.IResourceChangeEvent)
*/
- public void resourceChanged (IResourceChangeEvent event) {
-
- // System.out.println("IResourceChangeEvent: " + event + "; " + event.getType() );
- IResourceDelta[] deltas = event.getDelta().getAffectedChildren( IResourceDelta.CHANGED | IResourceDelta.REMOVED, IResource.FILE );
- processDeltas ( deltas );
+ public void resourceChanged(IResourceChangeEvent event) {
+
+ // System.out.println("IResourceChangeEvent: " + event + "; " +
+ // event.getType() );
+ IResourceDelta[] deltas = event.getDelta()
+ .getAffectedChildren(
+ IResourceDelta.CHANGED | IResourceDelta.REMOVED,
+ IResource.FILE);
+ processDeltas(deltas);
}
-
- void processDeltas ( IResourceDelta [] deltas ) {
-
- for(IResourceDelta delta : deltas) {
- processDeltas( delta.getAffectedChildren(IResourceDelta.CHANGED | IResourceDelta.REMOVED, IResource.FILE) );
-
+
+ void processDeltas(IResourceDelta[] deltas) {
+
+ for (IResourceDelta delta : deltas) {
+ processDeltas(delta.getAffectedChildren(IResourceDelta.CHANGED
+ | IResourceDelta.REMOVED, IResource.FILE));
+
IResource resource = delta.getResource();
- if (resource.getType () != IResource.FILE) {
+ if (resource.getType() != IResource.FILE) {
continue;
}
-
- if (delta.getKind() == IResourceDelta.REMOVED){
- resourceChanged((IFile)resource);
+
+ if (delta.getKind() == IResourceDelta.REMOVED) {
+ resourceChanged((IFile) resource);
continue;
}
-
-// * @see IResourceDelta#CONTENT
-// * @see IResourceDelta#DESCRIPTION
-// * @see IResourceDelta#ENCODING
-// * @see IResourceDelta#OPEN
-// * @see IResourceDelta#MOVED_TO
-// * @see IResourceDelta#MOVED_FROM
-// * @see IResourceDelta#TYPE
-// * @see IResourceDelta#SYNC
-// * @see IResourceDelta#MARKERS
-// * @see IResourceDelta#REPLACED
-
- if ((delta.getFlags() & IResourceDelta.CONTENT) == 0){
+
+ // * @see IResourceDelta#CONTENT
+ // * @see IResourceDelta#DESCRIPTION
+ // * @see IResourceDelta#ENCODING
+ // * @see IResourceDelta#OPEN
+ // * @see IResourceDelta#MOVED_TO
+ // * @see IResourceDelta#MOVED_FROM
+ // * @see IResourceDelta#TYPE
+ // * @see IResourceDelta#SYNC
+ // * @see IResourceDelta#MARKERS
+ // * @see IResourceDelta#REPLACED
+
+ if ((delta.getFlags() & IResourceDelta.CONTENT) == 0) {
continue;
}
-
+
// TODO: Temporary hack
// Actually we should remove all resources from the resourceSet,
// but for some reasons bpel files can't be removed now
- if ("bpel".equals(((IFile) resource).getFileExtension())){
+ if ("bpel".equals(((IFile) resource).getFileExtension())) {
continue;
}
-
+
resourceChanged((IFile) resource);
- }
+ }
}
-
- public void setLoadOptions (Map<Object, Object> options) {
+
+ public void setLoadOptions(Map<Object, Object> options) {
loadOptions = options;
}
-
+
/**
- * Resource has changed, remove it from the cache or list of loaded resources.
+ * Resource has changed, remove it from the cache or list of loaded
+ * resources.
*
* @param file
*/
- public void resourceChanged (IFile file) {
- // System.out.println("ResourceChanged: " + file );
- URI uri = URI.createPlatformResourceURI( file.getFullPath().toString() ) ;
- // System.out.println(" ResourceURI: " + uri );
+ public void resourceChanged(IFile file) {
+ // System.out.println("ResourceChanged: " + file );
+ URI uri = URI.createPlatformResourceURI(file.getFullPath().toString());
+ // System.out.println(" ResourceURI: " + uri );
URIConverter theURIConverter = getURIConverter();
URI normalizedURI = theURIConverter.normalize(uri);
-
+
if (uriResourceMap != null) {
uriResourceMap.remove(uri);
uriResourceMap.remove(normalizedURI);
// System.out.println("Removed from Map: " + map );
}
-
+
List<Resource> resourceList = getResources();
if (resources.size() < 1) {
- return ;
+ return;
}
-
- for(Resource r : new ArrayList<Resource>(resourceList) ) {
- if (uri.equals(r.getURI()) || normalizedURI.equals(r.getURI() )) {
+
+ for (Resource r : new ArrayList<Resource>(resourceList)) {
+ if (uri.equals(r.getURI()) || normalizedURI.equals(r.getURI())) {
resources.remove(r);
- // System.out.println("Removed from List: " + r );
+ // System.out.println("Removed from List: " + r );
}
}
}
14 years, 8 months
JBoss Tools SVN: r18175 - in trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh: server and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2009-10-19 23:57:27 -0400 (Mon, 19 Oct 2009)
New Revision: 18175
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHPublishUtil.java
Removed:
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/TestClass.java
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/Messages.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/Messages.properties
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/ISSHDeploymentConstants.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHServerBehaviourDelegate.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHZippedJSTPublisher.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/ui/editor/SSHDeploymentModuleTab.java
Log:
JBIDE-5048 - step 1 removing hard-coded details :(
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/Messages.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/Messages.java 2009-10-20 02:44:36 UTC (rev 18174)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/Messages.java 2009-10-20 03:57:27 UTC (rev 18175)
@@ -19,6 +19,7 @@
public static String UserLabel;
public static String PassLabel;
public static String DeployRootFolder;
+ public static String HostsLabel;
public static String EditorZipDeployments;
public static String EditorSetDeployCommandLabel;
public static String SSHDeploymentSectionTitle;
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/Messages.properties
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/Messages.properties 2009-10-20 02:44:36 UTC (rev 18174)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/Messages.properties 2009-10-20 03:57:27 UTC (rev 18175)
@@ -1,6 +1,7 @@
browse=Browse...
UserLabel=Username
PassLabel=Password
+HostsLabel=SSH Hosts File
DeployRootFolder=Deployment Folder
EditorZipDeployments=Deploy projects as compressed archives
EditorSetUserCommandLabel=Set Username
Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/TestClass.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/TestClass.java 2009-10-20 02:44:36 UTC (rev 18174)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/TestClass.java 2009-10-20 03:57:27 UTC (rev 18175)
@@ -1,164 +0,0 @@
-package org.jboss.ide.eclipse.as.ssh;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-import com.jcraft.jsch.Channel;
-import com.jcraft.jsch.ChannelExec;
-import com.jcraft.jsch.JSch;
-import com.jcraft.jsch.Session;
-import com.jcraft.jsch.UserInfo;
-
-public class TestClass {
- public static void main(String[] arg) {
- FileInputStream fis = null;
- try {
-
-
- String lfile = "/home/rob/apps/eclipse/workspaces/runtime/run12/.metadata/.plugins/org.jboss.ide.eclipse.as.core/SCP_Remote_Server_at_localhost/deploy/TEST10.jar";
- String rfile = "/home/rob/scptest999.jar";
- String host = "oxbeef.net";
- // username and password will be given via UserInfo interface.
- ServerUserInfo ui = new ServerUserInfo();
-
- JSch jsch = new JSch();
- Session session = jsch.getSession(ui.getUser(), host, 22);
- jsch.setKnownHosts(ui.getHostsFile());
- session.setUserInfo(ui);
- session.connect();
-
- // exec 'scp -t rfile' remotely
- String command = "scp -p -t " + rfile;
- Channel channel = session.openChannel("exec");
- ((ChannelExec) channel).setCommand(command);
-
- // get I/O streams for remote scp
- OutputStream out = channel.getOutputStream();
- InputStream in = channel.getInputStream();
-
- channel.connect();
-
- if (checkAck(in) != 0) {
- System.exit(0);
- }
-
- // send "C0644 filesize filename", where filename should not include
- // '/'
- long filesize = (new File(lfile)).length();
- command = "C0644 " + filesize + " ";
- if (lfile.lastIndexOf('/') > 0) {
- command += lfile.substring(lfile.lastIndexOf('/') + 1);
- } else {
- command += lfile;
- }
- command += "\n";
- System.out.println(command);
- out.write(command.getBytes());
- out.flush();
- if (checkAck(in) != 0) {
- System.exit(0);
- }
-
- // send a content of lfile
- fis = new FileInputStream(lfile);
- byte[] buf = new byte[1024];
- while (true) {
- int len = fis.read(buf, 0, buf.length);
- if (len <= 0)
- break;
- out.write(buf, 0, len); // out.flush();
- }
- fis.close();
- fis = null;
- // send '\0'
- buf[0] = 0;
- out.write(buf, 0, 1);
- out.flush();
- if (checkAck(in) != 0) {
- System.exit(0);
- }
- out.close();
-
- channel.disconnect();
- session.disconnect();
-
- System.exit(0);
- } catch (Exception e) {
- System.out.println(e);
- try {
- if (fis != null)
- fis.close();
- } catch (Exception ee) {
- }
- }
- }
-
- static int checkAck(InputStream in) throws IOException {
- int b = in.read();
- // b may be 0 for success,
- // 1 for error,
- // 2 for fatal error,
- // -1
- if (b == 0)
- return b;
- if (b == -1)
- return b;
-
- if (b == 1 || b == 2) {
- StringBuffer sb = new StringBuffer();
- int c;
- do {
- c = in.read();
- sb.append((char) c);
- } while (c != '\n');
- if (b == 1) { // error
- System.out.print(sb.toString());
- }
- if (b == 2) { // fatal error
- System.out.print(sb.toString());
- }
- }
- return b;
- }
-
- public static class ServerUserInfo implements UserInfo {
- private String user = "rob";
- private String password = "p3nh2ogo";
- private String hostsFile = "/home/rob/.ssh/known_hosts";
- public String getPassword() {
- return password;
- }
-
- public String getUser() {
- return user;
- }
-
- public String getHostsFile() {
- return hostsFile;
- }
-
- public String getPassphrase() {
- return null;
- }
-
- public boolean promptPassphrase(String message) {
- return true;
- }
-
- public boolean promptPassword(String message) {
- return true;
- }
-
- public void showMessage(String message) {
- // TODO eh?
- }
-
- public boolean promptYesNo(String message) {
- // TODO Auto-generated method stub
- return false;
- }
- }
-}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/ISSHDeploymentConstants.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/ISSHDeploymentConstants.java 2009-10-20 02:44:36 UTC (rev 18174)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/ISSHDeploymentConstants.java 2009-10-20 03:57:27 UTC (rev 18175)
@@ -1,6 +1,7 @@
package org.jboss.ide.eclipse.as.ssh.server;
public interface ISSHDeploymentConstants {
+ public static final String HOSTS_FILE = "org.jboss.ide.eclipse.as.ssh.server.hostsFile"; //$NON-NLS-1$
public static final String DEPLOY_DIRECTORY = "org.jboss.ide.eclipse.as.ssh.server.deployDirectory"; //$NON-NLS-1$
public static final String USERNAME = "org.jboss.ide.eclipse.as.ssh.server.username"; //$NON-NLS-1$
public static final String PASSWORD = "org.jboss.ide.eclipse.as.ssh.server.password"; //$NON-NLS-1$
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHPublishUtil.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHPublishUtil.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHPublishUtil.java 2009-10-20 03:57:27 UTC (rev 18175)
@@ -0,0 +1,25 @@
+package org.jboss.ide.eclipse.as.ssh.server;
+
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.internal.Server;
+
+public class SSHPublishUtil {
+ public static boolean getZipsSSHDeployments(IServer server) {
+ return ((Server)server).getAttribute(ISSHDeploymentConstants.ZIP_DEPLOYMENTS_PREF, false);
+ }
+ public static String getDeployDir(IServer server) {
+ return ((Server)server).getAttribute(ISSHDeploymentConstants.DEPLOY_DIRECTORY, "/home");
+ }
+
+ public static String getUser(IServer server) {
+ return ((Server)server).getAttribute(ISSHDeploymentConstants.USERNAME, "username");
+ }
+
+ public static String getPass(IServer server) {
+ return ((Server)server).getAttribute(ISSHDeploymentConstants.PASSWORD, "password");
+ }
+
+ public static String getHostsFile(IServer server) {
+ return ((Server)server).getAttribute(ISSHDeploymentConstants.HOSTS_FILE, (String)null);
+ }
+}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHServerBehaviourDelegate.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHServerBehaviourDelegate.java 2009-10-20 02:44:36 UTC (rev 18174)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHServerBehaviourDelegate.java 2009-10-20 03:57:27 UTC (rev 18175)
@@ -27,7 +27,7 @@
return new SSHPublishMethod(); // TODO FIX THIS in superclass
}
- public static class SSHPublishMethod extends LocalPublishMethod {
+ public class SSHPublishMethod extends LocalPublishMethod {
public static final String SSH_PUBLISH_METHOD = "ssh"; //$NON-NLS-1$
@Override
@@ -45,7 +45,7 @@
IProgressMonitor monitor) throws CoreException {
try {
- ServerUserInfo info = new ServerUserInfo();
+ ServerUserInfo info = new ServerUserInfo(getServer());
JSch jsch = new JSch();
session = jsch.getSession(info.getUser(), behaviour.getServer().getHost(), 22);
jsch.setKnownHosts(info.getHostsFile());
@@ -69,9 +69,14 @@
public static class ServerUserInfo implements UserInfo {
- private String user = "rob";
- private String password = "p3nh2ogo";
- private String hostsFile = "/home/rob/.ssh/known_hosts";
+ private String user;
+ private String password;
+ private String hostsFile;
+ public ServerUserInfo(IServer server) {
+ user = SSHPublishUtil.getUser(server);
+ password = SSHPublishUtil.getPass(server);
+ hostsFile = SSHPublishUtil.getHostsFile(server);
+ }
public String getPassword() {
return password;
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHZippedJSTPublisher.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHZippedJSTPublisher.java 2009-10-20 02:44:36 UTC (rev 18174)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHZippedJSTPublisher.java 2009-10-20 03:57:27 UTC (rev 18175)
@@ -45,7 +45,7 @@
IDeployableServer ds = ServerConverter.getDeployableServer(server);
boolean shouldAccept = ds != null
&& ModuleCoreNature.isFlexibleProject(module[0].getProject())
- && true; // TODO ds.zipsWTPDeployments();
+ && SSHPublishUtil.getZipsSSHDeployments(server);
return shouldAccept;
}
@@ -73,7 +73,6 @@
if( publishType == IJBossServerPublisher.REMOVE_PUBLISH) {
System.out.println("remove remote");
} else {
- // TODO FIX THIS
String deployFolder = getRemoteDeployFolder(server);
String deployFile = new Path(deployFolder).append(outputFilepath.lastSegment()).toString();
launchCopyCommand(method2.getSession(),
@@ -112,7 +111,6 @@
command += localFile;
}
command += "\n";
- System.out.println(command);
out.write(command.getBytes());
out.flush();
if (checkAck(in) != 0) {
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/ui/editor/SSHDeploymentModuleTab.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/ui/editor/SSHDeploymentModuleTab.java 2009-10-20 02:44:36 UTC (rev 18174)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/ui/editor/SSHDeploymentModuleTab.java 2009-10-20 03:57:27 UTC (rev 18175)
@@ -11,10 +11,14 @@
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.DirectoryDialog;
+import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.forms.IFormColors;
import org.eclipse.ui.forms.widgets.ExpandableComposite;
@@ -28,6 +32,7 @@
import org.jboss.ide.eclipse.as.core.util.DeploymentPreferenceLoader.DeploymentPreferences;
import org.jboss.ide.eclipse.as.ssh.Messages;
import org.jboss.ide.eclipse.as.ssh.server.ISSHDeploymentConstants;
+import org.jboss.ide.eclipse.as.ssh.server.SSHPublishUtil;
import org.jboss.ide.eclipse.as.ssh.server.SSHServerBehaviourDelegate.SSHPublishMethod;
import org.jboss.ide.eclipse.as.ui.editor.IDeploymentEditorTab;
import org.jboss.ide.eclipse.as.ui.editor.ModuleDeploymentPage;
@@ -68,11 +73,11 @@
return random;
}
- private Text userText, passText, deployText;
- private ModifyListener userListener, passListener, deployListener;
+ private Text userText, passText, deployText, hostsFileText;
+ private ModifyListener userListener, passListener, deployListener, hostsListener;
private ServerAttributeHelper helper;
- private Button zipDeployWTPProjects;
- private SelectionListener zipListener;
+ private Button zipDeployWTPProjects, browseHostsFileButton;
+ private SelectionListener zipListener, browseHostsButtonListener;
protected Composite createDefaultComposite(Composite parent) {
@@ -98,7 +103,7 @@
Control top = descriptionLabel;
Composite inner = toolkit.createComposite(composite);
- inner.setLayout(new GridLayout(3, true));
+ inner.setLayout(new GridLayout(3, false));
FormData innerData = new FormData();
innerData.top = new FormAttachment(descriptionLabel, 5);
@@ -113,7 +118,7 @@
Label label = toolkit.createLabel(inner,
Messages.DeployRootFolder);
label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
- deployText = toolkit.createText(inner, getDeployDir(), SWT.BORDER);
+ deployText = toolkit.createText(inner, SSHPublishUtil.getDeployDir(page.getServer().getOriginal()), SWT.BORDER);
deployListener = new ModifyListener() {
public void modifyText(ModifyEvent e) {
page.execute(new SetDeployDirCommand());
@@ -126,7 +131,7 @@
Label userLabel = toolkit.createLabel(inner,
Messages.UserLabel);
userLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
- userText = toolkit.createText(inner, getUser(), SWT.BORDER);
+ userText = toolkit.createText(inner, SSHPublishUtil.getUser(page.getServer().getOriginal()), SWT.BORDER);
userListener = new ModifyListener() {
public void modifyText(ModifyEvent e) {
page.execute(new SetUserCommand());
@@ -140,16 +145,46 @@
Label passLabel = toolkit.createLabel(inner,
Messages.PassLabel);
passLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
- passText = toolkit.createText(inner, getPass(), SWT.BORDER);
+ passText = toolkit.createText(inner, SSHPublishUtil.getPass(page.getServer().getOriginal()), SWT.BORDER);
passListener = new ModifyListener() {
public void modifyText(ModifyEvent e) {
page.execute(new SetPasswordCommand());
}
};
- passText.addModifyListener(deployListener);
+ passText.addModifyListener(passListener);
passText.setEnabled(true);
passText.setLayoutData(textData);
+ Label hostsLabel = toolkit.createLabel(inner,
+ Messages.HostsLabel);
+ hostsLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
+ Composite hostsFileComposite = new Composite(inner, SWT.NONE);
+ hostsFileComposite.setLayoutData(textData);
+ hostsFileComposite.setLayout(new GridLayout(2,false));
+
+ hostsFileText = toolkit.createText(hostsFileComposite, SSHPublishUtil.getHostsFile(page.getServer().getOriginal()), SWT.BORDER);
+ hostsListener = new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ page.execute(new SetHostsFileCommand());
+ }
+ };
+ hostsFileText.addModifyListener(hostsListener);
+ hostsFileText.setEnabled(true);
+ GridData hostsFileData = new GridData(SWT.LEFT, SWT.CENTER, true, false);
+ hostsFileData.widthHint = 200;
+ hostsFileData.grabExcessHorizontalSpace = true;
+ hostsFileText.setLayoutData(hostsFileData);
+
+ browseHostsFileButton = toolkit.createButton(hostsFileComposite, Messages.browse, SWT.PUSH);
+ browseHostsButtonListener = new SelectionListener() {
+ public void widgetSelected(SelectionEvent e) {
+ browseForHostsSelected();
+ }
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+ };
+ browseHostsFileButton.addSelectionListener(browseHostsButtonListener);
+
zipDeployWTPProjects = toolkit.createButton(composite,
Messages.EditorZipDeployments, SWT.CHECK);
boolean zippedPublisherAvailable = isSSHZippedPublisherAvailable();
@@ -190,6 +225,15 @@
return false;
}
+ protected void browseForHostsSelected() {
+ FileDialog d = new FileDialog(new Shell());
+ d.setFilterPath(page.makeGlobal(hostsFileText.getText()));
+ String x = d.open();
+ if (x != null) {
+ hostsFileText.setText(x);
+ }
+ }
+
public class SetPropertyCommand extends ServerCommand {
protected String oldDir;
protected String newDir;
@@ -237,6 +281,13 @@
passListener, ISSHDeploymentConstants.PASSWORD);
}
}
+
+ public class SetHostsFileCommand extends SetPropertyCommand {
+ public SetHostsFileCommand() {
+ super(Messages.EditorSetPasswordCommandLabel, hostsFileText,
+ hostsListener, ISSHDeploymentConstants.HOSTS_FILE);
+ }
+ }
public class SetZipCommand extends ServerCommand {
boolean oldVal;
@@ -259,18 +310,8 @@
}
}
- private String getDeployDir() {
- return helper.getAttribute(ISSHDeploymentConstants.DEPLOY_DIRECTORY, "/home");
- }
+
- private String getUser() {
- return helper.getAttribute(ISSHDeploymentConstants.USERNAME, "username");
- }
-
- private String getPass() {
- return helper.getAttribute(ISSHDeploymentConstants.PASSWORD, "password");
- }
-
private boolean getZipsSSHDeployments() {
return helper.getAttribute(ISSHDeploymentConstants.ZIP_DEPLOYMENTS_PREF, false);
}
14 years, 8 months
JBoss Tools SVN: r18174 - branches.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2009-10-19 22:44:36 -0400 (Mon, 19 Oct 2009)
New Revision: 18174
Added:
branches/jbosstools-3.1.0.M4/
Log:
branch for M4
Copied: branches/jbosstools-3.1.0.M4 (from rev 18173, trunk)
14 years, 8 months
JBoss Tools SVN: r18172 - in trunk/as/plugins: org.jboss.ide.eclipse.as.ssh and 23 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2009-10-19 17:54:07 -0400 (Mon, 19 Oct 2009)
New Revision: 18172
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/.classpath
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/.project
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/.settings/
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/.settings/org.eclipse.jdt.core.prefs
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/META-INF/
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/META-INF/MANIFEST.MF
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/Messages.class
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/Messages.properties
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/SSHDeploymentPlugin.class
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/TestClass$ServerUserInfo.class
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/TestClass.class
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/server/
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/server/ISSHDeploymentConstants.class
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/server/SSHPublisher.class
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/server/SSHServerBehaviourDelegate$SSHPublishMethod.class
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/server/SSHServerBehaviourDelegate$ServerUserInfo.class
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/server/SSHServerBehaviourDelegate.class
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/server/SSHServerDelegate.class
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/server/SSHServerRuntime.class
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/server/SSHZippedJSTPublisher.class
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/ui/
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/ui/editor/
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/ui/editor/DeploymentPage.class
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/ui/editor/SSHDeploymentModuleTab$1.class
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/ui/editor/SSHDeploymentModuleTab$2.class
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/ui/editor/SSHDeploymentModuleTab$3.class
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/ui/editor/SSHDeploymentModuleTab$4.class
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/ui/editor/SSHDeploymentModuleTab$SetDeployDirCommand.class
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/ui/editor/SSHDeploymentModuleTab$SetPasswordCommand.class
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/ui/editor/SSHDeploymentModuleTab$SetPropertyCommand.class
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/ui/editor/SSHDeploymentModuleTab$SetUserCommand.class
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/ui/editor/SSHDeploymentModuleTab$SetZipCommand.class
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/ui/editor/SSHDeploymentModuleTab.class
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/build.properties
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/icons/
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/icons/ssh-16x16.png
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/plugin.xml
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/Messages.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/Messages.properties
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/SSHDeploymentPlugin.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/TestClass.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/ISSHDeploymentConstants.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHPublisher.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHServerBehaviourDelegate.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHServerDelegate.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHServerRuntime.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHZippedJSTPublisher.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/ui/
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/ui/editor/
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/ui/editor/DeploymentPage.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/ui/editor/SSHDeploymentModuleTab.java
Log:
JBIDE-5048 - step 1, publishing zipped WTP projects
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/.classpath
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/.classpath (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/.classpath 2009-10-19 21:54:07 UTC (rev 18172)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/.project
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/.project (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/.project 2009-10-19 21:54:07 UTC (rev 18172)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.ide.eclipse.as.ssh</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/.settings/org.eclipse.jdt.core.prefs 2009-10-19 21:54:07 UTC (rev 18172)
@@ -0,0 +1,8 @@
+#Mon Oct 12 15:41:36 GMT-05:00 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/META-INF/MANIFEST.MF
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/META-INF/MANIFEST.MF (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/META-INF/MANIFEST.MF 2009-10-19 21:54:07 UTC (rev 18172)
@@ -0,0 +1,26 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Ssh
+Bundle-SymbolicName: org.jboss.ide.eclipse.as.ssh;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.jboss.ide.eclipse.as.ssh.SSHDeploymentPlugin
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ com.jcraft.jsch;bundle-version="0.1.41",
+ org.eclipse.jsch.core;bundle-version="1.1.100",
+ org.eclipse.jsch.ui;bundle-version="1.1.200",
+ org.eclipse.wst.server.core;bundle-version="1.1.102",
+ org.eclipse.wst.server.ui;bundle-version="1.1.103",
+ org.eclipse.jst.jee;bundle-version="1.0.201",
+ org.eclipse.jst.j2ee;bundle-version="1.1.301",
+ org.eclipse.jst.j2ee.core;bundle-version="1.1.301",
+ org.eclipse.jst.server.core;bundle-version="1.2.0",
+ org.jboss.ide.eclipse.as.core;bundle-version="1.0.0",
+ org.eclipse.debug.core;bundle-version="3.5.0",
+ org.eclipse.wst.common.emfworkbench.integration;bundle-version="1.1.301",
+ org.eclipse.jem.util;bundle-version="2.0.200",
+ org.jboss.ide.eclipse.archives.webtools;bundle-version="1.0.0",
+ org.jboss.ide.eclipse.as.ui;bundle-version="1.0.0",
+ org.eclipse.ui.forms;bundle-version="3.4.1"
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/Messages.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/Messages.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/Messages.properties
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/Messages.properties (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/Messages.properties 2009-10-19 21:54:07 UTC (rev 18172)
@@ -0,0 +1,10 @@
+browse=Browse...
+UserLabel=Username
+PassLabel=Password
+DeployRootFolder=Deployment Folder
+EditorZipDeployments=Deploy projects as compressed archives
+EditorSetUserCommandLabel=Set Username
+EditorSetPasswordCommandLabel=Set Password
+EditorSetDeployCommandLabel=Set Remote Deployment Folder
+SSHDeploymentSectionTitle=SSH Deployment
+SSHDeploymentDescription=Description of SSH Deployment (TODO)
\ No newline at end of file
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/Messages.properties
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/SSHDeploymentPlugin.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/SSHDeploymentPlugin.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/TestClass$ServerUserInfo.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/TestClass$ServerUserInfo.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/TestClass.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/TestClass.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/server/ISSHDeploymentConstants.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/server/ISSHDeploymentConstants.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/server/SSHPublisher.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/server/SSHPublisher.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/server/SSHServerBehaviourDelegate$SSHPublishMethod.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/server/SSHServerBehaviourDelegate$SSHPublishMethod.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/server/SSHServerBehaviourDelegate$ServerUserInfo.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/server/SSHServerBehaviourDelegate$ServerUserInfo.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/server/SSHServerBehaviourDelegate.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/server/SSHServerBehaviourDelegate.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/server/SSHServerDelegate.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/server/SSHServerDelegate.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/server/SSHServerRuntime.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/server/SSHServerRuntime.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/server/SSHZippedJSTPublisher.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/server/SSHZippedJSTPublisher.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/ui/editor/DeploymentPage.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/ui/editor/DeploymentPage.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/ui/editor/SSHDeploymentModuleTab$1.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/ui/editor/SSHDeploymentModuleTab$1.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/ui/editor/SSHDeploymentModuleTab$2.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/ui/editor/SSHDeploymentModuleTab$2.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/ui/editor/SSHDeploymentModuleTab$3.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/ui/editor/SSHDeploymentModuleTab$3.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/ui/editor/SSHDeploymentModuleTab$4.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/ui/editor/SSHDeploymentModuleTab$4.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/ui/editor/SSHDeploymentModuleTab$SetDeployDirCommand.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/ui/editor/SSHDeploymentModuleTab$SetDeployDirCommand.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/ui/editor/SSHDeploymentModuleTab$SetPasswordCommand.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/ui/editor/SSHDeploymentModuleTab$SetPasswordCommand.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/ui/editor/SSHDeploymentModuleTab$SetPropertyCommand.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/ui/editor/SSHDeploymentModuleTab$SetPropertyCommand.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/ui/editor/SSHDeploymentModuleTab$SetUserCommand.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/ui/editor/SSHDeploymentModuleTab$SetUserCommand.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/ui/editor/SSHDeploymentModuleTab$SetZipCommand.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/ui/editor/SSHDeploymentModuleTab$SetZipCommand.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/ui/editor/SSHDeploymentModuleTab.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/bin/org/jboss/ide/eclipse/as/ssh/ui/editor/SSHDeploymentModuleTab.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/build.properties
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/build.properties (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/build.properties 2009-10-19 21:54:07 UTC (rev 18172)
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/icons/ssh-16x16.png
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/icons/ssh-16x16.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/plugin.xml
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/plugin.xml (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/plugin.xml 2009-10-19 21:54:07 UTC (rev 18172)
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.wst.server.core.serverTypes">
+ <serverType
+ behaviourClass="org.jboss.ide.eclipse.as.ssh.server.SSHServerBehaviourDelegate"
+ class="org.jboss.ide.eclipse.as.ssh.server.SSHServerDelegate"
+ description="A server which simply scp's files to a destination host and location"
+ id="org.jboss.ide.eclipse.as.ssh.server.remoteServerType"
+ name="SCP Remote Server"
+ runtime="false"
+ runtimeTypeId="org.jboss.ide.eclipse.as.ssh.server.remoteServerRuntimeType"
+ supportsRemoteHosts="true">
+ </serverType>
+ </extension>
+
+
+ <!-- This runtime type is here just to get around some weird UI checking.
+ It *can* be removed later SAFELY without breaking anything. The server
+ wizard will *not* create the runtime, but just check that the type is set.
+ ... So broken ;) -->
+
+ <extension
+ point="org.eclipse.wst.server.core.runtimeTypes">
+ <runtimeType
+ vendor="JBoss Stuff"
+ class="org.jboss.ide.eclipse.as.ssh.server.SSHServerRuntime"
+ description="A runtime to allow SSH servers to support every module type. "
+ name="SSH Runtime"
+ id="org.jboss.ide.eclipse.as.ssh.server.remoteServerRuntimeType"
+ version="1.0">
+ <moduleType
+ types="jst.web"
+ versions="2.2, 2.3, 2.4, 2.5"/>
+ <moduleType
+ types="jst.ejb"
+ versions="1.0, 1.1, 2.0, 2.1, 3.0"/>
+ <moduleType
+ types="jst.ear"
+ versions="1.2, 1.3, 1.4, 5.0"/>
+ <moduleType
+ types="jst.connector"
+ versions="1.0, 1.5"/>
+ <moduleType
+ types="jst.utility"
+ versions="1.0"/>
+ <moduleType
+ types="jboss.package"
+ versions="1.0"/>
+ <moduleType
+ types="jboss.singlefile"
+ versions="1.0"/>
+ <moduleType
+ types="jst.jboss.esb"
+ versions="4.2,4.3,4.4,4.5,4.6,5.0">
+ </moduleType>
+ <moduleType
+ types="jbt.bpel.module"
+ versions="1.1, 2.0">
+ </moduleType>
+ </runtimeType>
+ </extension>
+ <extension
+ point="org.jboss.ide.eclipse.as.core.publishers">
+ <publisher
+ class="org.jboss.ide.eclipse.as.ssh.server.SSHZippedJSTPublisher"
+ priority="3"
+ zipDelegate="true">
+ </publisher>
+ </extension>
+
+
+ <!-- Some UI -->
+ <extension
+ point="org.eclipse.wst.server.ui.editorPages">
+ <page
+ class="org.jboss.ide.eclipse.as.ssh.ui.editor.DeploymentPage"
+ id="org.jboss.ide.eclipse.as.ssh.ui.editor.DeploymentPage"
+ name="Deployment"
+ typeIds="org.jboss.ide.eclipse.as.ssh.server.remoteServerType">
+ </page>
+ </extension>
+ <extension
+ point="org.eclipse.wst.server.ui.serverImages">
+ <image
+ icon="icons/ssh-16x16.png"
+ id="org.jboss.ide.eclipse.as.ssh.server.icons"
+ typeIds="org.jboss.ide.eclipse.as.ssh.server.remoteServerType">
+ </image>
+ </extension>
+
+</plugin>
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/Messages.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/Messages.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/Messages.java 2009-10-19 21:54:07 UTC (rev 18172)
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.ssh;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME = "org.jboss.ide.eclipse.as.ssh.Messages"; //$NON-NLS-1$
+
+ public static String browse;
+ public static String UserLabel;
+ public static String PassLabel;
+ public static String DeployRootFolder;
+ public static String EditorZipDeployments;
+ public static String EditorSetDeployCommandLabel;
+ public static String SSHDeploymentSectionTitle;
+ public static String SSHDeploymentDescription;
+ public static String EditorSetUserCommandLabel;
+ public static String EditorSetPasswordCommandLabel;
+ static {
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+ private Messages() {
+ }
+}
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/Messages.java
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/Messages.properties
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/Messages.properties (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/Messages.properties 2009-10-19 21:54:07 UTC (rev 18172)
@@ -0,0 +1,10 @@
+browse=Browse...
+UserLabel=Username
+PassLabel=Password
+DeployRootFolder=Deployment Folder
+EditorZipDeployments=Deploy projects as compressed archives
+EditorSetUserCommandLabel=Set Username
+EditorSetPasswordCommandLabel=Set Password
+EditorSetDeployCommandLabel=Set Remote Deployment Folder
+SSHDeploymentSectionTitle=SSH Deployment
+SSHDeploymentDescription=Description of SSH Deployment (TODO)
\ No newline at end of file
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/Messages.properties
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/SSHDeploymentPlugin.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/SSHDeploymentPlugin.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/SSHDeploymentPlugin.java 2009-10-19 21:54:07 UTC (rev 18172)
@@ -0,0 +1,50 @@
+package org.jboss.ide.eclipse.as.ssh;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class SSHDeploymentPlugin extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.jboss.ide.eclipse.as.ssh";
+
+ // The shared instance
+ private static SSHDeploymentPlugin plugin;
+
+ /**
+ * The constructor
+ */
+ public SSHDeploymentPlugin() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static SSHDeploymentPlugin getDefault() {
+ return plugin;
+ }
+
+}
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/TestClass.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/TestClass.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/TestClass.java 2009-10-19 21:54:07 UTC (rev 18172)
@@ -0,0 +1,164 @@
+package org.jboss.ide.eclipse.as.ssh;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import com.jcraft.jsch.Channel;
+import com.jcraft.jsch.ChannelExec;
+import com.jcraft.jsch.JSch;
+import com.jcraft.jsch.Session;
+import com.jcraft.jsch.UserInfo;
+
+public class TestClass {
+ public static void main(String[] arg) {
+ FileInputStream fis = null;
+ try {
+
+
+ String lfile = "/home/rob/apps/eclipse/workspaces/runtime/run12/.metadata/.plugins/org.jboss.ide.eclipse.as.core/SCP_Remote_Server_at_localhost/deploy/TEST10.jar";
+ String rfile = "/home/rob/scptest999.jar";
+ String host = "oxbeef.net";
+ // username and password will be given via UserInfo interface.
+ ServerUserInfo ui = new ServerUserInfo();
+
+ JSch jsch = new JSch();
+ Session session = jsch.getSession(ui.getUser(), host, 22);
+ jsch.setKnownHosts(ui.getHostsFile());
+ session.setUserInfo(ui);
+ session.connect();
+
+ // exec 'scp -t rfile' remotely
+ String command = "scp -p -t " + rfile;
+ Channel channel = session.openChannel("exec");
+ ((ChannelExec) channel).setCommand(command);
+
+ // get I/O streams for remote scp
+ OutputStream out = channel.getOutputStream();
+ InputStream in = channel.getInputStream();
+
+ channel.connect();
+
+ if (checkAck(in) != 0) {
+ System.exit(0);
+ }
+
+ // send "C0644 filesize filename", where filename should not include
+ // '/'
+ long filesize = (new File(lfile)).length();
+ command = "C0644 " + filesize + " ";
+ if (lfile.lastIndexOf('/') > 0) {
+ command += lfile.substring(lfile.lastIndexOf('/') + 1);
+ } else {
+ command += lfile;
+ }
+ command += "\n";
+ System.out.println(command);
+ out.write(command.getBytes());
+ out.flush();
+ if (checkAck(in) != 0) {
+ System.exit(0);
+ }
+
+ // send a content of lfile
+ fis = new FileInputStream(lfile);
+ byte[] buf = new byte[1024];
+ while (true) {
+ int len = fis.read(buf, 0, buf.length);
+ if (len <= 0)
+ break;
+ out.write(buf, 0, len); // out.flush();
+ }
+ fis.close();
+ fis = null;
+ // send '\0'
+ buf[0] = 0;
+ out.write(buf, 0, 1);
+ out.flush();
+ if (checkAck(in) != 0) {
+ System.exit(0);
+ }
+ out.close();
+
+ channel.disconnect();
+ session.disconnect();
+
+ System.exit(0);
+ } catch (Exception e) {
+ System.out.println(e);
+ try {
+ if (fis != null)
+ fis.close();
+ } catch (Exception ee) {
+ }
+ }
+ }
+
+ static int checkAck(InputStream in) throws IOException {
+ int b = in.read();
+ // b may be 0 for success,
+ // 1 for error,
+ // 2 for fatal error,
+ // -1
+ if (b == 0)
+ return b;
+ if (b == -1)
+ return b;
+
+ if (b == 1 || b == 2) {
+ StringBuffer sb = new StringBuffer();
+ int c;
+ do {
+ c = in.read();
+ sb.append((char) c);
+ } while (c != '\n');
+ if (b == 1) { // error
+ System.out.print(sb.toString());
+ }
+ if (b == 2) { // fatal error
+ System.out.print(sb.toString());
+ }
+ }
+ return b;
+ }
+
+ public static class ServerUserInfo implements UserInfo {
+ private String user = "rob";
+ private String password = "p3nh2ogo";
+ private String hostsFile = "/home/rob/.ssh/known_hosts";
+ public String getPassword() {
+ return password;
+ }
+
+ public String getUser() {
+ return user;
+ }
+
+ public String getHostsFile() {
+ return hostsFile;
+ }
+
+ public String getPassphrase() {
+ return null;
+ }
+
+ public boolean promptPassphrase(String message) {
+ return true;
+ }
+
+ public boolean promptPassword(String message) {
+ return true;
+ }
+
+ public void showMessage(String message) {
+ // TODO eh?
+ }
+
+ public boolean promptYesNo(String message) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+ }
+}
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/ISSHDeploymentConstants.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/ISSHDeploymentConstants.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/ISSHDeploymentConstants.java 2009-10-19 21:54:07 UTC (rev 18172)
@@ -0,0 +1,8 @@
+package org.jboss.ide.eclipse.as.ssh.server;
+
+public interface ISSHDeploymentConstants {
+ public static final String DEPLOY_DIRECTORY = "org.jboss.ide.eclipse.as.ssh.server.deployDirectory"; //$NON-NLS-1$
+ public static final String USERNAME = "org.jboss.ide.eclipse.as.ssh.server.username"; //$NON-NLS-1$
+ public static final String PASSWORD = "org.jboss.ide.eclipse.as.ssh.server.password"; //$NON-NLS-1$
+ public static final String ZIP_DEPLOYMENTS_PREF = "org.jboss.ide.eclipse.as.ssh.server.zipDeploymentsPreference"; //$NON-NLS-1$
+}
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHPublisher.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHPublisher.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHPublisher.java 2009-10-19 21:54:07 UTC (rev 18172)
@@ -0,0 +1,17 @@
+package org.jboss.ide.eclipse.as.ssh.server;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IServer;
+
+public class SSHPublisher {
+ protected void publishStart(IServer server, final IProgressMonitor monitor) throws CoreException {
+ }
+
+ protected void publishFinish(IServer server, final IProgressMonitor monitor) throws CoreException {
+ }
+
+ protected void publishModule(int publishType, IModule[] module, IProgressMonitor monitor) throws CoreException {
+ }
+}
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHServerBehaviourDelegate.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHServerBehaviourDelegate.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHServerBehaviourDelegate.java 2009-10-19 21:54:07 UTC (rev 18172)
@@ -0,0 +1,109 @@
+package org.jboss.ide.eclipse.as.ssh.server;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.wst.server.core.IServer;
+import org.jboss.ide.eclipse.as.core.publishers.LocalPublishMethod;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerPublishMethod;
+import org.jboss.ide.eclipse.as.core.server.internal.DeployableServerBehavior;
+
+import com.jcraft.jsch.JSch;
+import com.jcraft.jsch.JSchException;
+import com.jcraft.jsch.Session;
+import com.jcraft.jsch.UserInfo;
+
+public class SSHServerBehaviourDelegate extends DeployableServerBehavior {
+
+ public SSHServerBehaviourDelegate() {
+ super();
+ }
+
+ @Override
+ public void stop(boolean force) {
+ setServerState(IServer.STATE_STOPPED);
+ }
+
+ protected IJBossServerPublishMethod createPublishMethod() {
+ return new SSHPublishMethod(); // TODO FIX THIS in superclass
+ }
+
+ public static class SSHPublishMethod extends LocalPublishMethod {
+ public static final String SSH_PUBLISH_METHOD = "ssh"; //$NON-NLS-1$
+
+ @Override
+ public String getPublishMethodId() {
+ return SSH_PUBLISH_METHOD;
+ }
+
+ private Session session;
+ public Session getSession() {
+ return session;
+ }
+
+ @Override
+ public void publishStart(DeployableServerBehavior behaviour,
+ IProgressMonitor monitor) throws CoreException {
+
+ try {
+ ServerUserInfo info = new ServerUserInfo();
+ JSch jsch = new JSch();
+ session = jsch.getSession(info.getUser(), behaviour.getServer().getHost(), 22);
+ jsch.setKnownHosts(info.getHostsFile());
+ session.setUserInfo(info);
+ session.connect();
+ } catch( JSchException jsche) {
+ // TODO handle
+ }
+ }
+
+ @Override
+ public int publishFinish(DeployableServerBehavior behaviour,
+ IProgressMonitor monitor) throws CoreException {
+ int ret = super.publishFinish(behaviour, monitor);
+ if( session != null )
+ session.disconnect();
+ session = null;
+ return ret;
+ }
+ }
+
+
+ public static class ServerUserInfo implements UserInfo {
+ private String user = "rob";
+ private String password = "p3nh2ogo";
+ private String hostsFile = "/home/rob/.ssh/known_hosts";
+ public String getPassword() {
+ return password;
+ }
+
+ public String getUser() {
+ return user;
+ }
+
+ public String getHostsFile() {
+ return hostsFile;
+ }
+
+ public String getPassphrase() {
+ return null;
+ }
+
+ public boolean promptPassphrase(String message) {
+ return true;
+ }
+
+ public boolean promptPassword(String message) {
+ return true;
+ }
+
+ public void showMessage(String message) {
+ // TODO eh?
+ }
+
+ public boolean promptYesNo(String message) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+ }
+
+}
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHServerDelegate.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHServerDelegate.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHServerDelegate.java 2009-10-19 21:54:07 UTC (rev 18172)
@@ -0,0 +1,23 @@
+package org.jboss.ide.eclipse.as.ssh.server;
+
+import org.jboss.ide.eclipse.as.core.server.IJBossServerRuntime;
+import org.jboss.ide.eclipse.as.core.server.internal.DeployableServer;
+
+public class SSHServerDelegate extends DeployableServer {
+
+ public SSHServerDelegate() {
+ // TODO Auto-generated constructor stub
+ }
+
+ public IJBossServerRuntime getRuntime() {
+ return null;
+ }
+
+ public String getUsername() {
+ return getAttribute(ISSHDeploymentConstants.USERNAME, (String)null);
+ }
+
+ public String getPassword() {
+ return getAttribute(ISSHDeploymentConstants.PASSWORD, (String)null);
+ }
+}
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHServerRuntime.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHServerRuntime.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHServerRuntime.java 2009-10-19 21:54:07 UTC (rev 18172)
@@ -0,0 +1,11 @@
+package org.jboss.ide.eclipse.as.ssh.server;
+
+import org.eclipse.wst.server.core.model.RuntimeDelegate;
+
+public class SSHServerRuntime extends RuntimeDelegate {
+
+ public SSHServerRuntime() {
+ super();
+ }
+
+}
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHZippedJSTPublisher.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHZippedJSTPublisher.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/server/SSHZippedJSTPublisher.java 2009-10-19 21:54:07 UTC (rev 18172)
@@ -0,0 +1,180 @@
+package org.jboss.ide.eclipse.as.ssh.server;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.wst.common.componentcore.ModuleCoreNature;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.internal.Server;
+import org.eclipse.wst.server.core.model.IModuleResourceDelta;
+import org.jboss.ide.eclipse.archives.webtools.modules.LocalZippedPublisherUtil;
+import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
+import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerConstants;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerPublishMethod;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerPublisher;
+import org.jboss.ide.eclipse.as.core.util.ServerConverter;
+import org.jboss.ide.eclipse.as.ssh.SSHDeploymentPlugin;
+import org.jboss.ide.eclipse.as.ssh.server.SSHServerBehaviourDelegate.SSHPublishMethod;
+
+import com.jcraft.jsch.Channel;
+import com.jcraft.jsch.ChannelExec;
+import com.jcraft.jsch.JSchException;
+import com.jcraft.jsch.Session;
+
+public class SSHZippedJSTPublisher implements IJBossServerPublisher {
+
+ public SSHZippedJSTPublisher() {
+ }
+
+ public boolean accepts(String method, IServer server, IModule[] module) {
+ if( !method.equals(SSHPublishMethod.SSH_PUBLISH_METHOD))
+ return false;
+ if( module == null )
+ return true;
+ IDeployableServer ds = ServerConverter.getDeployableServer(server);
+ boolean shouldAccept = ds != null
+ && ModuleCoreNature.isFlexibleProject(module[0].getProject())
+ && true; // TODO ds.zipsWTPDeployments();
+ return shouldAccept;
+ }
+
+ public int getPublishState() {
+ return IServer.PUBLISH_STATE_NONE;
+ }
+
+ public IStatus publishModule(
+ IJBossServerPublishMethod method,
+ IServer server, IModule[] module,
+ int publishType, IModuleResourceDelta[] delta,
+ IProgressMonitor monitor) throws CoreException {
+ // Let the local zipped publisher do the work in a local / metadata folder
+ IStatus returnStatus = null;
+ SSHPublishMethod method2 = (SSHPublishMethod)method;
+ IPath deployRoot = JBossServerCorePlugin.getServerStateLocation(server).
+ append(IJBossServerConstants.DEPLOY).makeAbsolute();
+
+ LocalZippedPublisherUtil localDelegate = new LocalZippedPublisherUtil();
+ IStatus localCopyStatus = localDelegate.publishModule(server,
+ deployRoot.toOSString(), module, publishType, delta, monitor);
+ IPath outputFilepath = localDelegate.getOutputFilePath();
+
+ // Am I a removal? If yes, remove me, and return
+ if( publishType == IJBossServerPublisher.REMOVE_PUBLISH) {
+ System.out.println("remove remote");
+ } else {
+ // TODO FIX THIS
+ String deployFolder = getRemoteDeployFolder(server);
+ String deployFile = new Path(deployFolder).append(outputFilepath.lastSegment()).toString();
+ launchCopyCommand(method2.getSession(),
+ outputFilepath.toString(), deployFile);
+ }
+ return null;
+ }
+
+ protected String getRemoteDeployFolder(IServer server) {
+ return ((Server)server).getAttribute(ISSHDeploymentConstants.DEPLOY_DIRECTORY, (String)null);
+ }
+
+ protected void launchCopyCommand(Session session, String localFile, String remoteLocation) throws CoreException {
+ try {
+ // exec 'scp -t rfile' remotely
+ String command = "scp -p -t " + remoteLocation;
+ Channel channel = session.openChannel("exec");
+ ((ChannelExec) channel).setCommand(command);
+
+ // get I/O streams for remote scp
+ OutputStream out = channel.getOutputStream();
+ InputStream in = channel.getInputStream();
+ channel.connect();
+ if (checkAck(in) != 0) {
+ // TODO throw new exception
+ throw new CoreException(new Status(IStatus.ERROR, SSHDeploymentPlugin.PLUGIN_ID, "no idea bug"));
+ }
+
+ // send "C0644 filesize filename", where filename should not include
+ // '/'
+ long filesize = (new File(localFile)).length();
+ command = "C0644 " + filesize + " ";
+ if (localFile.lastIndexOf('/') > 0) {
+ command += localFile.substring(localFile.lastIndexOf('/') + 1);
+ } else {
+ command += localFile;
+ }
+ command += "\n";
+ System.out.println(command);
+ out.write(command.getBytes());
+ out.flush();
+ if (checkAck(in) != 0) {
+ // TODO throw new exception
+ throw new CoreException(new Status(IStatus.ERROR, SSHDeploymentPlugin.PLUGIN_ID, "no idea bug"));
+ }
+
+ // send a content of lfile
+ FileInputStream fis = new FileInputStream(localFile);
+ byte[] buf = new byte[1024];
+ while (true) {
+ int len = fis.read(buf, 0, buf.length);
+ if (len <= 0)
+ break;
+ out.write(buf, 0, len); // out.flush();
+ }
+ fis.close();
+ fis = null;
+ // send '\0'
+ buf[0] = 0;
+ out.write(buf, 0, 1);
+ out.flush();
+ if (checkAck(in) != 0) {
+ System.exit(0);
+ }
+ out.close();
+
+ channel.disconnect();
+ } catch( JSchException jsche ) {
+ // TODO
+ jsche.printStackTrace();
+ } catch( IOException ioe) {
+ // TODO
+ ioe.printStackTrace();
+ }
+ }
+
+ static int checkAck(InputStream in) throws IOException {
+ int b = in.read();
+ // b may be 0 for success,
+ // 1 for error,
+ // 2 for fatal error,
+ // -1
+ if (b == 0)
+ return b;
+ if (b == -1)
+ return b;
+
+ if (b == 1 || b == 2) {
+ StringBuffer sb = new StringBuffer();
+ int c;
+ do {
+ c = in.read();
+ sb.append((char) c);
+ } while (c != '\n');
+ if (b == 1) { // error
+ System.out.print(sb.toString());
+ }
+ if (b == 2) { // fatal error
+ System.out.print(sb.toString());
+ }
+ }
+ return b;
+ }
+}
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/ui/editor/DeploymentPage.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/ui/editor/DeploymentPage.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/ui/editor/DeploymentPage.java 2009-10-19 21:54:07 UTC (rev 18172)
@@ -0,0 +1,23 @@
+package org.jboss.ide.eclipse.as.ssh.ui.editor;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.TabFolder;
+import org.eclipse.swt.widgets.TabItem;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.jboss.ide.eclipse.as.ui.editor.IDeploymentEditorTab;
+import org.jboss.ide.eclipse.as.ui.editor.ModuleDeploymentPage;
+
+public class DeploymentPage extends ModuleDeploymentPage {
+ protected IDeploymentEditorTab[] createTabs(FormToolkit toolkit, TabFolder tabFolder) {
+ TabItem tabItem = new TabItem(tabFolder, SWT.NULL);
+ IDeploymentEditorTab tab = new SSHDeploymentModuleTab();
+ tabItem.setText(tab.getTabName());
+ tab.setDeploymentPage(this);
+ tab.setDeploymentPrefs(preferences);
+ tabItem.setControl(tab.createControl(tabFolder));
+ toolkit.adapt((Composite)tabItem.getControl());
+
+ return new IDeploymentEditorTab[] { tab };
+ }
+}
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/ui/editor/SSHDeploymentModuleTab.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/ui/editor/SSHDeploymentModuleTab.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/ui/editor/SSHDeploymentModuleTab.java 2009-10-19 21:54:07 UTC (rev 18172)
@@ -0,0 +1,282 @@
+package org.jboss.ide.eclipse.as.ssh.ui.editor;
+
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.forms.IFormColors;
+import org.eclipse.ui.forms.widgets.ExpandableComposite;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.Section;
+import org.eclipse.wst.server.ui.internal.command.ServerCommand;
+import org.jboss.ide.eclipse.as.core.ExtensionManager;
+import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerPublisher;
+import org.jboss.ide.eclipse.as.core.server.internal.ServerAttributeHelper;
+import org.jboss.ide.eclipse.as.core.util.DeploymentPreferenceLoader.DeploymentPreferences;
+import org.jboss.ide.eclipse.as.ssh.Messages;
+import org.jboss.ide.eclipse.as.ssh.server.ISSHDeploymentConstants;
+import org.jboss.ide.eclipse.as.ssh.server.SSHServerBehaviourDelegate.SSHPublishMethod;
+import org.jboss.ide.eclipse.as.ui.editor.IDeploymentEditorTab;
+import org.jboss.ide.eclipse.as.ui.editor.ModuleDeploymentPage;
+
+public class SSHDeploymentModuleTab implements IDeploymentEditorTab {
+ private ModuleDeploymentPage page;
+ private DeploymentPreferences preferences;
+
+ public SSHDeploymentModuleTab() {
+ }
+
+ public String getTabName() {
+ return "SSH Deployment";
+ }
+
+ public void setDeploymentPage(ModuleDeploymentPage page) {
+ this.page = page;
+ }
+
+ public void setDeploymentPrefs(DeploymentPreferences prefs) {
+ this.preferences = prefs;
+ }
+
+ public Control createControl(Composite parent) {
+ helper = new ServerAttributeHelper(page.getServer().getOriginal(), page.getServer());
+
+ Composite random = new Composite(parent, SWT.NONE);
+ GridData randomData = new GridData(GridData.FILL_BOTH);
+ random.setLayoutData(randomData);
+ random.setLayout(new FormLayout());
+
+ Composite defaultComposite = createDefaultComposite(random);
+ FormData fd = new FormData();
+ fd.left = new FormAttachment(0, 5);
+ fd.top = new FormAttachment(0, 5);
+ fd.right = new FormAttachment(100, -5);
+ defaultComposite.setLayoutData(fd);
+ return random;
+ }
+
+ private Text userText, passText, deployText;
+ private ModifyListener userListener, passListener, deployListener;
+ private ServerAttributeHelper helper;
+ private Button zipDeployWTPProjects;
+ private SelectionListener zipListener;
+
+ protected Composite createDefaultComposite(Composite parent) {
+
+ FormToolkit toolkit = new FormToolkit(parent.getDisplay());
+
+ Section section = toolkit.createSection(parent,
+ ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED
+ | ExpandableComposite.TITLE_BAR);
+ section.setText(Messages.SSHDeploymentSectionTitle);
+ section.setLayoutData(new GridData(GridData.FILL_HORIZONTAL
+ | GridData.VERTICAL_ALIGN_FILL));
+
+ Composite composite = toolkit.createComposite(section);
+
+ composite.setLayout(new FormLayout());
+
+ Label descriptionLabel = toolkit.createLabel(composite,
+ Messages.SSHDeploymentDescription);
+ FormData descriptionLabelData = new FormData();
+ descriptionLabelData.left = new FormAttachment(0, 5);
+ descriptionLabelData.top = new FormAttachment(0, 5);
+ descriptionLabel.setLayoutData(descriptionLabelData);
+
+ Control top = descriptionLabel;
+ Composite inner = toolkit.createComposite(composite);
+ inner.setLayout(new GridLayout(3, true));
+
+ FormData innerData = new FormData();
+ innerData.top = new FormAttachment(descriptionLabel, 5);
+ innerData.left = new FormAttachment(0, 5);
+ innerData.right = new FormAttachment(100, -5);
+ inner.setLayoutData(innerData);
+ top = inner;
+
+ GridData textData = new GridData(SWT.LEFT, SWT.CENTER, true, false, 2, 1);
+ textData.widthHint = 300;
+
+ Label label = toolkit.createLabel(inner,
+ Messages.DeployRootFolder);
+ label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
+ deployText = toolkit.createText(inner, getDeployDir(), SWT.BORDER);
+ deployListener = new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ page.execute(new SetDeployDirCommand());
+ }
+ };
+ deployText.addModifyListener(deployListener);
+ deployText.setEnabled(true);
+ deployText.setLayoutData(textData);
+
+ Label userLabel = toolkit.createLabel(inner,
+ Messages.UserLabel);
+ userLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
+ userText = toolkit.createText(inner, getUser(), SWT.BORDER);
+ userListener = new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ page.execute(new SetUserCommand());
+ }
+ };
+ userText.addModifyListener(userListener);
+ userText.setEnabled(true);
+ userText.setLayoutData(textData);
+
+
+ Label passLabel = toolkit.createLabel(inner,
+ Messages.PassLabel);
+ passLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
+ passText = toolkit.createText(inner, getPass(), SWT.BORDER);
+ passListener = new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ page.execute(new SetPasswordCommand());
+ }
+ };
+ passText.addModifyListener(deployListener);
+ passText.setEnabled(true);
+ passText.setLayoutData(textData);
+
+ zipDeployWTPProjects = toolkit.createButton(composite,
+ Messages.EditorZipDeployments, SWT.CHECK);
+ boolean zippedPublisherAvailable = isSSHZippedPublisherAvailable();
+ boolean value = getZipsSSHDeployments();
+ zipDeployWTPProjects.setEnabled(zippedPublisherAvailable);
+ zipDeployWTPProjects.setSelection(zippedPublisherAvailable && value);
+
+ FormData zipButtonData = new FormData();
+ zipButtonData.right = new FormAttachment(100, -5);
+ zipButtonData.left = new FormAttachment(0, 5);
+ zipButtonData.top = new FormAttachment(top, 5);
+ zipDeployWTPProjects.setLayoutData(zipButtonData);
+
+ zipListener = new SelectionListener() {
+ public void widgetSelected(SelectionEvent e) {
+ page.execute(new SetZipCommand());
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ widgetSelected(e);
+ }
+ };
+ zipDeployWTPProjects.addSelectionListener(zipListener);
+
+ toolkit.paintBordersFor(composite);
+ section.setClient(composite);
+ page.getSaveStatus();
+ return section;
+ }
+
+ protected boolean isSSHZippedPublisherAvailable() {
+ IJBossServerPublisher[] publishers =
+ ExtensionManager.getDefault().getZippedPublishers();
+ for( int i = 0; i < publishers.length; i++ ) {
+ if( publishers[i].accepts(SSHPublishMethod.SSH_PUBLISH_METHOD, getServer().getServer(), null))
+ return true;
+ }
+ return false;
+ }
+
+ public class SetPropertyCommand extends ServerCommand {
+ protected String oldDir;
+ protected String newDir;
+ protected Text text;
+ protected ModifyListener listener;
+ protected String attribute;
+ public SetPropertyCommand(String label, Text text, ModifyListener listener, String attribute) {
+ super(page.getServer(), label);
+ this.text = text;
+ this.newDir = text.getText();
+ this.listener = listener;
+ this.attribute = attribute;
+ this.oldDir = helper.getAttribute(attribute, ""); //$NON-NLS-1$
+ }
+ public void execute() {
+ helper.setAttribute(attribute, newDir);
+ page.getSaveStatus();
+ }
+ public void undo() {
+ text.removeModifyListener(listener);
+ helper.setAttribute(attribute, oldDir);
+ text.setText(oldDir);
+ text.addModifyListener(listener);
+ page.getSaveStatus();
+ }
+ }
+
+ public class SetDeployDirCommand extends SetPropertyCommand {
+ public SetDeployDirCommand() {
+ super(Messages.EditorSetDeployCommandLabel, deployText,
+ deployListener, ISSHDeploymentConstants.DEPLOY_DIRECTORY);
+ }
+ }
+
+ public class SetUserCommand extends SetPropertyCommand {
+ public SetUserCommand() {
+ super(Messages.EditorSetUserCommandLabel, userText,
+ userListener, ISSHDeploymentConstants.USERNAME);
+ }
+ }
+
+ public class SetPasswordCommand extends SetPropertyCommand {
+ public SetPasswordCommand() {
+ super(Messages.EditorSetPasswordCommandLabel, passText,
+ passListener, ISSHDeploymentConstants.PASSWORD);
+ }
+ }
+
+ public class SetZipCommand extends ServerCommand {
+ boolean oldVal;
+ boolean newVal;
+ public SetZipCommand() {
+ super(page.getServer(), Messages.EditorZipDeployments);
+ oldVal = helper.getAttribute(ISSHDeploymentConstants.ZIP_DEPLOYMENTS_PREF, false);
+ newVal = zipDeployWTPProjects.getSelection();
+ }
+ public void execute() {
+ helper.setAttribute(ISSHDeploymentConstants.ZIP_DEPLOYMENTS_PREF, newVal);
+ page.getSaveStatus();
+ }
+ public void undo() {
+ zipDeployWTPProjects.removeSelectionListener(zipListener);
+ zipDeployWTPProjects.setSelection(oldVal);
+ helper.setAttribute(ISSHDeploymentConstants.ZIP_DEPLOYMENTS_PREF, oldVal);
+ zipDeployWTPProjects.addSelectionListener(zipListener);
+ page.getSaveStatus();
+ }
+ }
+
+ private String getDeployDir() {
+ return helper.getAttribute(ISSHDeploymentConstants.DEPLOY_DIRECTORY, "/home");
+ }
+
+ private String getUser() {
+ return helper.getAttribute(ISSHDeploymentConstants.USERNAME, "username");
+ }
+
+ private String getPass() {
+ return helper.getAttribute(ISSHDeploymentConstants.PASSWORD, "password");
+ }
+
+ private boolean getZipsSSHDeployments() {
+ return helper.getAttribute(ISSHDeploymentConstants.ZIP_DEPLOYMENTS_PREF, false);
+ }
+
+ private IDeployableServer getServer() {
+ return (IDeployableServer) page.getServer().loadAdapter(
+ IDeployableServer.class, new NullProgressMonitor());
+ }
+}
14 years, 8 months
JBoss Tools SVN: r18171 - in trunk/as/plugins: org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules and 7 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2009-10-19 17:52:18 -0400 (Mon, 19 Oct 2009)
New Revision: 18171
Added:
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/LocalZippedPublisherUtil.java
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/plugin.xml
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/PackagesPublisher.java
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/WTPZippedPublisher.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/ExtensionManager.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/LocalPublishMethod.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/NullPublisher.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/PublishUtil.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/SingleFilePublisher.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IJBossServerPublishMethod.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IJBossServerPublisher.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DeployableServerBehavior.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/xpl/PublishCopyUtil.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/META-INF/MANIFEST.MF
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/LocalDeploymentModuleTab.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ModuleDeploymentPage.java
Log:
JBIDE-5048 - preparation for step 1, getting some APIs in order
Modified: trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/plugin.xml
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/plugin.xml 2009-10-19 17:21:45 UTC (rev 18170)
+++ trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/plugin.xml 2009-10-19 21:52:18 UTC (rev 18171)
@@ -92,7 +92,7 @@
</publisher>
<publisher
class="org.jboss.ide.eclipse.archives.webtools.modules.WTPZippedPublisher"
- priority="0"
+ priority="2"
zipDelegate="true">
</publisher>
</extension>
Added: trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/LocalZippedPublisherUtil.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/LocalZippedPublisherUtil.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/LocalZippedPublisherUtil.java 2009-10-19 21:52:18 UTC (rev 18171)
@@ -0,0 +1,287 @@
+package org.jboss.ide.eclipse.archives.webtools.modules;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.internal.Server;
+import org.eclipse.wst.server.core.model.IModuleFile;
+import org.eclipse.wst.server.core.model.IModuleFolder;
+import org.eclipse.wst.server.core.model.IModuleResource;
+import org.eclipse.wst.server.core.model.IModuleResourceDelta;
+import org.jboss.ide.eclipse.archives.core.util.internal.TrueZipUtil;
+import org.jboss.ide.eclipse.archives.webtools.IntegrationPlugin;
+import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
+import org.jboss.ide.eclipse.as.core.extensions.events.IEventCodes;
+import org.jboss.ide.eclipse.as.core.publishers.PublishUtil;
+import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerPublisher;
+import org.jboss.ide.eclipse.as.core.server.internal.DeployableServerBehavior;
+import org.jboss.ide.eclipse.as.core.util.FileUtil;
+import org.jboss.ide.eclipse.as.core.util.FileUtil.IFileUtilListener;
+
+import de.schlichtherle.io.ArchiveDetector;
+
+public class LocalZippedPublisherUtil extends PublishUtil {
+
+ private IServer server;
+ private String deployRoot;
+ private IModule[] module;
+ private int publishType;
+ private IModuleResourceDelta[] delta;
+
+ public IStatus publishModule(IServer server, String deployRoot, IModule[] module,
+ int publishType, IModuleResourceDelta[] delta,
+ IProgressMonitor monitor) throws CoreException {
+ this.server = server;
+ this.deployRoot = deployRoot;
+ this.module = module;
+ this.publishType = publishType;
+ this.delta = delta;
+
+ IStatus[] returnStatus;
+
+
+ // Am I a removal? If yes, remove me, and return
+ if( publishType == IJBossServerPublisher.REMOVE_PUBLISH)
+ returnStatus = removeModule(server, deployRoot, module);
+
+ // Am I a full publish? If yes, full publish me, and return
+ else if( publishType == IJBossServerPublisher.FULL_PUBLISH)
+ returnStatus = fullPublish(server, deployRoot, module);
+
+ else {
+ // Am I changed? If yes, handle my changes
+ ArrayList<IStatus> results = new ArrayList<IStatus>();
+ if( countChanges(delta) > 0) {
+ results.addAll(Arrays.asList(publishChanges(server, deployRoot, module)));
+ }
+
+ IModule[] children = server.getChildModules(module, new NullProgressMonitor());
+ results.addAll(Arrays.asList(handleChildrenDeltas(server, deployRoot, module, children)));
+
+ // Handle the removed children that are not returned by getChildModules
+ List<IModule[]> removed = getBehaviour(server).getRemovedModules();
+ Iterator<IModule[]> i = removed.iterator();
+ while(i.hasNext()) {
+ IModule[] removedArray = i.next();
+ if( removedArray[0].getId().equals(module[0].getId())) {
+ results.addAll(Arrays.asList(removeModule(server, deployRoot, removedArray)));
+ }
+ }
+ returnStatus = (IStatus[]) results.toArray(new IStatus[results.size()]);
+ }
+ TrueZipUtil.umount();
+
+ IStatus finalStatus;
+ if( returnStatus.length > 0 ) {
+ MultiStatus ms = new MultiStatus(JBossServerCorePlugin.PLUGIN_ID, IEventCodes.JST_PUB_INC_FAIL,
+ "Publish Failed for module " + module[0].getName(), null); //$NON-NLS-1$
+ for( int i = 0; i < returnStatus.length; i++ )
+ ms.add(returnStatus[i]);
+ finalStatus = ms;
+ } else
+ finalStatus = Status.OK_STATUS;
+
+ return finalStatus;
+ }
+
+
+ protected IDeployableServer getDeployableServer(IServer server) {
+ return (IDeployableServer)server.loadAdapter(IDeployableServer.class, new NullProgressMonitor());
+ }
+ protected DeployableServerBehavior getBehaviour(IServer server) {
+ return (DeployableServerBehavior)server.loadAdapter(DeployableServerBehavior.class, new NullProgressMonitor());
+ }
+
+ protected List<IModule[]> getRemovedModules(IServer s) {
+ return getBehaviour(s).getRemovedModules();
+ }
+
+ protected IStatus[] handleChildrenDeltas(IServer server, String deployRoot, IModule[] module, IModule[] children) {
+ // For each child:
+ ArrayList<IStatus> results = new ArrayList<IStatus>();
+ for( int i = 0; i < children.length; i++ ) {
+ IModule[] combinedChild = combine(module, children[i]);
+ // if it's new, full publish it
+ if( !getBehaviour(server).hasBeenPublished(combinedChild)) {
+ results.addAll(Arrays.asList(fullPublish(server, deployRoot, combinedChild)));
+ }
+ // else if it's removed, full remove it
+ else if( isRemoved(server, combinedChild)) {
+ results.addAll(Arrays.asList(removeModule(server, deployRoot, combinedChild)));
+ }
+ // else
+ else {
+ // handle changed resources
+ results.addAll(Arrays.asList(publishChanges(server, deployRoot, combinedChild)));
+
+ // recurse
+ IModule[] children2 = server.getChildModules(combinedChild, new NullProgressMonitor());
+ results.addAll(Arrays.asList(handleChildrenDeltas(server, deployRoot, children, children2)));
+ }
+ }
+ return (IStatus[]) results.toArray(new IStatus[results.size()]);
+ }
+
+ protected boolean isRemoved(IServer server, IModule[] child) {
+ List<IModule[]> removed = getBehaviour(server).getRemovedModules();
+ Iterator<IModule[]> i = removed.iterator();
+ while(i.hasNext()) {
+ IModule[] next = i.next();
+ if( next.length == child.length) {
+ for( int j = 0; j < next.length; j++ ) {
+ if( !next[j].getId().equals(child[j].getId())) {
+ continue;
+ }
+ }
+ return true;
+ }
+ }
+ return false;
+ }
+
+ protected IStatus[] removeModule(IServer server, String deployRoot, IModule[] module) {
+ IPath deployPath = getOutputFilePath();
+ final ArrayList<IStatus> status = new ArrayList<IStatus>();
+ IFileUtilListener listener = new IFileUtilListener() {
+ public void fileCopied(File source, File dest, boolean result,Exception e) {}
+ public void fileDeleted(File file, boolean result, Exception e) {
+ if( result == false || e != null ) {
+ status.add(new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID, IEventCodes.JST_PUB_FILE_DELETE_FAIL,
+ "Attempt to delete " + file.getAbsolutePath() + " failed",e)); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+ public void folderDeleted(File file, boolean result, Exception e) {
+ if( result == false || e != null ) {
+ status.add(new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID, IEventCodes.JST_PUB_FILE_DELETE_FAIL,
+ "Attempt to delete " + file.getAbsolutePath() + " failed",e)); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+ };
+ FileUtil.safeDelete(deployPath.toFile(), listener);
+ return (IStatus[]) status.toArray(new IStatus[status.size()]);
+ }
+
+ protected IStatus[] fullPublish(IServer server, String deployRoot, IModule[] module) {
+ ArrayList<IStatus> results = new ArrayList<IStatus>();
+ try {
+ IPath path = getOutputFilePath();
+ // Get rid of the old
+ FileUtil.safeDelete(path.toFile(), null);
+
+ TrueZipUtil.createArchive(path);
+ de.schlichtherle.io.File root = TrueZipUtil.getFile(path, TrueZipUtil.getJarArchiveDetector());
+ IModuleResource[] resources = getResources(module);
+ results.addAll(Arrays.asList(copy(root, resources)));
+
+ IModule[] children = server.getChildModules(module, new NullProgressMonitor());
+ for( int i = 0; i < children.length; i++ )
+ results.addAll(Arrays.asList(fullPublish(server, deployRoot, combine(module, children[i]))));
+ return (IStatus[]) results.toArray(new IStatus[results.size()]);
+ } catch( CoreException ce) {
+ results.add(generateCoreExceptionStatus(ce));
+ return (IStatus[]) results.toArray(new IStatus[results.size()]);
+ }
+ }
+
+ protected IStatus[] publishChanges(IServer server, String deployRoot, IModule[] module) {
+ IPath path = getOutputFilePath();
+ de.schlichtherle.io.File root = TrueZipUtil.getFile(path, TrueZipUtil.getJarArchiveDetector());
+ IModuleResourceDelta[] deltas = ((Server)server).getPublishedResourceDelta(module);
+ return publishChanges(server, deltas, root);
+ }
+
+ protected IStatus[] publishChanges(IServer server, IModuleResourceDelta[] deltas, de.schlichtherle.io.File root) {
+ ArrayList<IStatus> results = new ArrayList<IStatus>();
+ if( deltas == null || deltas.length == 0 )
+ return new IStatus[]{};
+ int dKind;
+ IModuleResource resource;
+ for( int i = 0; i < deltas.length; i++ ) {
+ dKind = deltas[i].getKind();
+ resource = deltas[i].getModuleResource();
+ if( dKind == IModuleResourceDelta.ADDED ) {
+ results.addAll(Arrays.asList(copy(root, new IModuleResource[]{resource})));
+ } else if( dKind == IModuleResourceDelta.CHANGED ) {
+ if( resource instanceof IModuleFile )
+ results.addAll(Arrays.asList(copy(root, new IModuleResource[]{resource})));
+ results.addAll(Arrays.asList(publishChanges(server, deltas[i].getAffectedChildren(), root)));
+ } else if( dKind == IModuleResourceDelta.REMOVED) {
+ de.schlichtherle.io.File f = getFileInArchive(root,
+ resource.getModuleRelativePath().append(
+ resource.getName()));
+ boolean b = f.deleteAll();
+ if( !b )
+ results.add(generateDeleteFailedStatus(f));
+ } else if( dKind == IModuleResourceDelta.NO_CHANGE ) {
+ results.addAll(Arrays.asList(publishChanges(server, deltas[i].getAffectedChildren(), root)));
+ }
+ }
+
+ return (IStatus[]) results.toArray(new IStatus[results.size()]);
+ }
+
+
+ protected IStatus[] copy(de.schlichtherle.io.File root, IModuleResource[] children) {
+ ArrayList<IStatus> results = new ArrayList<IStatus>();
+ for( int i = 0; i < children.length; i++ ) {
+ if( children[i] instanceof IModuleFile ) {
+ IModuleFile mf = (IModuleFile)children[i];
+ java.io.File source = getFile(mf);
+ de.schlichtherle.io.File destination = getFileInArchive(root, mf.getModuleRelativePath().append(mf.getName()));
+ boolean b = new de.schlichtherle.io.File(source).copyAllTo(destination);
+ if( !b )
+ results.add(generateCopyFailStatus(source, destination));
+ } else if( children[i] instanceof IModuleFolder ) {
+ de.schlichtherle.io.File destination = getFileInArchive(root, children[i].getModuleRelativePath().append(children[i].getName()));
+ destination.mkdirs();
+ IModuleFolder mf = (IModuleFolder)children[i];
+ results.addAll(Arrays.asList(copy(root, mf.members())));
+ }
+ }
+ return (IStatus[]) results.toArray(new IStatus[results.size()]);
+ }
+
+ protected IStatus generateDeleteFailedStatus(java.io.File file) {
+ return new Status(IStatus.ERROR, IntegrationPlugin.PLUGIN_ID, "Could not delete file " + file); //$NON-NLS-1$
+ }
+ protected IStatus generateCoreExceptionStatus(CoreException ce) {
+ return new Status(IStatus.ERROR, IntegrationPlugin.PLUGIN_ID, ce.getMessage(), ce);
+ }
+ protected IStatus generateCopyFailStatus(java.io.File source, java.io.File destination) {
+ return new Status(IStatus.ERROR, IntegrationPlugin.PLUGIN_ID, "Copy of " + source + " to " + destination + " has failed");//$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
+ }
+
+ protected de.schlichtherle.io.File getFileInArchive(de.schlichtherle.io.File root, IPath relative) {
+ while(relative.segmentCount() > 0 ) {
+ root = new de.schlichtherle.io.File(root,
+ relative.segment(0), ArchiveDetector.DEFAULT);
+ relative = relative.removeFirstSegments(1);
+ }
+ return root;
+ }
+
+ private IModule[] combine(IModule[] module, IModule newMod) {
+ IModule[] retval = new IModule[module.length + 1];
+ for( int i = 0; i < module.length; i++ )
+ retval[i]=module[i];
+ retval[retval.length-1] = newMod;
+ return retval;
+ }
+
+ public IPath getOutputFilePath() {
+ return getDeployPath(module, deployRoot);
+ }
+}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/PackagesPublisher.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/PackagesPublisher.java 2009-10-19 17:21:45 UTC (rev 18170)
+++ trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/PackagesPublisher.java 2009-10-19 21:52:18 UTC (rev 18171)
@@ -18,7 +18,6 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.osgi.util.NLS;
import org.eclipse.wst.server.core.IModule;
@@ -27,7 +26,6 @@
import org.eclipse.wst.server.core.model.IModuleFolder;
import org.eclipse.wst.server.core.model.IModuleResource;
import org.eclipse.wst.server.core.model.IModuleResourceDelta;
-import org.jboss.ide.eclipse.archives.core.build.ArchiveBuildDelegate;
import org.jboss.ide.eclipse.archives.core.model.IArchive;
import org.jboss.ide.eclipse.archives.core.util.PathUtils;
import org.jboss.ide.eclipse.archives.webtools.IntegrationPlugin;
@@ -35,8 +33,10 @@
import org.jboss.ide.eclipse.archives.webtools.modules.PackageModuleFactory.ExtendedModuleFile;
import org.jboss.ide.eclipse.archives.webtools.modules.PackageModuleFactory.IExtendedModuleResource;
import org.jboss.ide.eclipse.archives.webtools.modules.PackageModuleFactory.PackagedModuleDelegate;
+import org.jboss.ide.eclipse.as.core.publishers.LocalPublishMethod;
import org.jboss.ide.eclipse.as.core.publishers.PublishUtil;
import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerPublishMethod;
import org.jboss.ide.eclipse.as.core.server.IJBossServerPublisher;
import org.jboss.ide.eclipse.as.core.util.FileUtil;
import org.jboss.ide.eclipse.as.core.util.ServerConverter;
@@ -59,12 +59,14 @@
}
public boolean accepts(String method, IServer server, IModule[] module) {
- if( "local".equals(method) && module != null && module.length > 0 //$NON-NLS-1$
+ if( LocalPublishMethod.LOCAL_PUBLISH_METHOD.equals(method) && module != null && module.length > 0
&& PackageModuleFactory.MODULE_TYPE.equals(module[0].getModuleType().getId()))
return true;
return false;
}
- public IStatus publishModule(IServer server, IModule[] module,
+ public IStatus publishModule(
+ IJBossServerPublishMethod method,
+ IServer server, IModule[] module,
int publishType, IModuleResourceDelta[] delta,
IProgressMonitor monitor)
throws CoreException {
Modified: trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/WTPZippedPublisher.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/WTPZippedPublisher.java 2009-10-19 17:21:45 UTC (rev 18170)
+++ trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/WTPZippedPublisher.java 2009-10-19 21:52:18 UTC (rev 18171)
@@ -1,292 +1,52 @@
package org.jboss.ide.eclipse.archives.webtools.modules;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Status;
import org.eclipse.wst.common.componentcore.ModuleCoreNature;
import org.eclipse.wst.server.core.IModule;
import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.internal.Server;
-import org.eclipse.wst.server.core.model.IModuleFile;
-import org.eclipse.wst.server.core.model.IModuleFolder;
-import org.eclipse.wst.server.core.model.IModuleResource;
import org.eclipse.wst.server.core.model.IModuleResourceDelta;
-import org.jboss.ide.eclipse.archives.core.util.internal.TrueZipUtil;
-import org.jboss.ide.eclipse.archives.webtools.IntegrationPlugin;
-import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
-import org.jboss.ide.eclipse.as.core.extensions.events.IEventCodes;
+import org.jboss.ide.eclipse.as.core.publishers.LocalPublishMethod;
import org.jboss.ide.eclipse.as.core.publishers.PublishUtil;
import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerPublishMethod;
import org.jboss.ide.eclipse.as.core.server.IJBossServerPublisher;
-import org.jboss.ide.eclipse.as.core.server.internal.DeployableServerBehavior;
-import org.jboss.ide.eclipse.as.core.util.FileUtil;
+import org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants;
import org.jboss.ide.eclipse.as.core.util.ServerConverter;
-import org.jboss.ide.eclipse.as.core.util.FileUtil.IFileUtilListener;
-import de.schlichtherle.io.ArchiveDetector;
-
public class WTPZippedPublisher extends PublishUtil implements IJBossServerPublisher {
private int moduleState = IServer.PUBLISH_STATE_NONE;
public boolean accepts(String method, IServer server, IModule[] module) {
- // TODO check for zip preference
- return "local".equals(method) && //$NON-NLS-1$
- ModuleCoreNature.isFlexibleProject(module[0].getProject());
+ IDeployableServer ds = ServerConverter.getDeployableServer(server);
+ IModule lastMod = (module == null || module.length == 0 ) ? null : module[module.length -1];
+ if( LocalPublishMethod.LOCAL_PUBLISH_METHOD.equals(method) && lastMod == null)
+ return true;
+ return LocalPublishMethod.LOCAL_PUBLISH_METHOD.equals(method)
+ && ModuleCoreNature.isFlexibleProject(lastMod.getProject())
+ && ds != null && ds.zipsWTPDeployments();
}
public int getPublishState() {
return moduleState;
}
-
- protected IDeployableServer getDeployableServer(IServer server) {
- return (IDeployableServer)server.loadAdapter(IDeployableServer.class, new NullProgressMonitor());
- }
- protected DeployableServerBehavior getBehaviour(IServer server) {
- return (DeployableServerBehavior)server.loadAdapter(DeployableServerBehavior.class, new NullProgressMonitor());
- }
- protected List<IModule[]> getRemovedModules(IServer s) {
- return getBehaviour(s).getRemovedModules();
- }
-
- public boolean isNew(IModule[] module, IServer s) {
- return !getBehaviour(s).hasBeenPublished(module);
- }
-
-
- public IStatus publishModule(IServer server, IModule[] module,
+ public IStatus publishModule(
+ IJBossServerPublishMethod method,
+ IServer server, IModule[] module,
int publishType, IModuleResourceDelta[] delta,
IProgressMonitor monitor) throws CoreException {
if( module.length > 1 ) {
return Status.OK_STATUS;
}
- IStatus[] returnStatus;
- // Am I a removal? If yes, remove me, and return
- if( publishType == IJBossServerPublisher.REMOVE_PUBLISH)
- returnStatus = removeModule(server, module);
-
- // Am I a full publish? If yes, full publish me, and return
- else if( publishType == IJBossServerPublisher.FULL_PUBLISH)
- returnStatus = fullPublish(server, module);
-
- else {
- // Am I changed? If yes, handle my changes
- ArrayList<IStatus> results = new ArrayList<IStatus>();
- if( countChanges(delta) > 0) {
- results.addAll(Arrays.asList(publishChanges(server, module)));
- }
-
- IModule[] children = server.getChildModules(module, new NullProgressMonitor());
- results.addAll(Arrays.asList(handleChildrenDeltas(server, module, children)));
-
- // Handle the removed children that are not returned by getChildModules
- List<IModule[]> removed = getBehaviour(server).getRemovedModules();
- Iterator<IModule[]> i = removed.iterator();
- while(i.hasNext()) {
- IModule[] removedArray = i.next();
- if( removedArray[0].getId().equals(module[0].getId())) {
- results.addAll(Arrays.asList(removeModule(server, removedArray)));
- }
- }
- returnStatus = (IStatus[]) results.toArray(new IStatus[results.size()]);
- }
- TrueZipUtil.umount();
-
- IStatus finalStatus;
- if( returnStatus.length > 0 ) {
- MultiStatus ms = new MultiStatus(JBossServerCorePlugin.PLUGIN_ID, IEventCodes.JST_PUB_INC_FAIL,
- "Publish Failed for module " + module[0].getName(), null); //$NON-NLS-1$
- for( int i = 0; i < returnStatus.length; i++ )
- ms.add(returnStatus[i]);
- finalStatus = ms;
- } else
- finalStatus = Status.OK_STATUS;
-
- return finalStatus;
- }
-
- protected IStatus[] handleChildrenDeltas(IServer server, IModule[] module, IModule[] children) {
- // For each child:
- ArrayList<IStatus> results = new ArrayList<IStatus>();
- for( int i = 0; i < children.length; i++ ) {
- IModule[] combinedChild = combine(module, children[i]);
- // if it's new, full publish it
- if( !getBehaviour(server).hasBeenPublished(combinedChild)) {
- results.addAll(Arrays.asList(fullPublish(server, combinedChild)));
- }
- // else if it's removed, full remove it
- else if( isRemoved(server, combinedChild)) {
- results.addAll(Arrays.asList(removeModule(server, combinedChild)));
- }
- // else
- else {
- // handle changed resources
- results.addAll(Arrays.asList(publishChanges(server, combinedChild)));
-
- // recurse
- IModule[] children2 = server.getChildModules(combinedChild, new NullProgressMonitor());
- results.addAll(Arrays.asList(handleChildrenDeltas(server, children, children2)));
- }
- }
- return (IStatus[]) results.toArray(new IStatus[results.size()]);
- }
-
- protected boolean isRemoved(IServer server, IModule[] child) {
- List<IModule[]> removed = getBehaviour(server).getRemovedModules();
- Iterator<IModule[]> i = removed.iterator();
- while(i.hasNext()) {
- IModule[] next = i.next();
- if( next.length == child.length) {
- for( int j = 0; j < next.length; j++ ) {
- if( !next[j].getId().equals(child[j].getId())) {
- continue;
- }
- }
- return true;
- }
- }
- return false;
- }
-
- protected IStatus[] removeModule(IServer server, IModule[] module) {
IDeployableServer ds = ServerConverter.getDeployableServer(server);
- IPath deployPath = getDeployPath(module, ds);
- final ArrayList<IStatus> status = new ArrayList<IStatus>();
- IFileUtilListener listener = new IFileUtilListener() {
- public void fileCopied(File source, File dest, boolean result,Exception e) {}
- public void fileDeleted(File file, boolean result, Exception e) {
- if( result == false || e != null ) {
- status.add(new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID, IEventCodes.JST_PUB_FILE_DELETE_FAIL,
- "Attempt to delete " + file.getAbsolutePath() + " failed",e)); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- public void folderDeleted(File file, boolean result, Exception e) {
- if( result == false || e != null ) {
- status.add(new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID, IEventCodes.JST_PUB_FILE_DELETE_FAIL,
- "Attempt to delete " + file.getAbsolutePath() + " failed",e)); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- };
- FileUtil.safeDelete(deployPath.toFile(), listener);
- return (IStatus[]) status.toArray(new IStatus[status.size()]);
- }
-
- protected IStatus[] fullPublish(IServer server, IModule[] module) {
- ArrayList<IStatus> results = new ArrayList<IStatus>();
- IDeployableServer ds = ServerConverter.getDeployableServer(server);
- try {
- IPath path = getDeployPath(module, ds);
- // Get rid of the old
- FileUtil.safeDelete(path.toFile(), null);
-
- TrueZipUtil.createArchive(path);
- de.schlichtherle.io.File root = TrueZipUtil.getFile(path, TrueZipUtil.getJarArchiveDetector());
- IModuleResource[] resources = getResources(module);
- results.addAll(Arrays.asList(copy(root, resources)));
-
- IModule[] children = server.getChildModules(module, new NullProgressMonitor());
- for( int i = 0; i < children.length; i++ )
- results.addAll(Arrays.asList(fullPublish(server, combine(module, children[i]))));
- return (IStatus[]) results.toArray(new IStatus[results.size()]);
- } catch( CoreException ce) {
- results.add(generateCoreExceptionStatus(ce));
- return (IStatus[]) results.toArray(new IStatus[results.size()]);
- }
- }
-
- protected IStatus[] publishChanges(IServer server, IModule[] module) {
- IDeployableServer ds = ServerConverter.getDeployableServer(server);
- IPath path = getDeployPath(module, ds);
- de.schlichtherle.io.File root = TrueZipUtil.getFile(path, TrueZipUtil.getJarArchiveDetector());
- IModuleResourceDelta[] deltas = ((Server)server).getPublishedResourceDelta(module);
- return publishChanges(server, deltas, root);
- }
-
- protected IStatus[] publishChanges(IServer server, IModuleResourceDelta[] deltas, de.schlichtherle.io.File root) {
- ArrayList<IStatus> results = new ArrayList<IStatus>();
- if( deltas == null || deltas.length == 0 )
- return new IStatus[]{};
- int dKind;
- IModuleResource resource;
- for( int i = 0; i < deltas.length; i++ ) {
- dKind = deltas[i].getKind();
- resource = deltas[i].getModuleResource();
- if( dKind == IModuleResourceDelta.ADDED ) {
- results.addAll(Arrays.asList(copy(root, new IModuleResource[]{resource})));
- } else if( dKind == IModuleResourceDelta.CHANGED ) {
- if( resource instanceof IModuleFile )
- results.addAll(Arrays.asList(copy(root, new IModuleResource[]{resource})));
- results.addAll(Arrays.asList(publishChanges(server, deltas[i].getAffectedChildren(), root)));
- } else if( dKind == IModuleResourceDelta.REMOVED) {
- de.schlichtherle.io.File f = getFileInArchive(root,
- resource.getModuleRelativePath().append(
- resource.getName()));
- boolean b = f.deleteAll();
- if( !b )
- results.add(generateDeleteFailedStatus(f));
- } else if( dKind == IModuleResourceDelta.NO_CHANGE ) {
- results.addAll(Arrays.asList(publishChanges(server, deltas[i].getAffectedChildren(), root)));
- }
- }
+ String deployRoot = PublishUtil.getDeployRootFolder(
+ module, ds, ds.getDeployFolder(),
+ IJBossToolingConstants.LOCAL_DEPLOYMENT_LOC);
- return (IStatus[]) results.toArray(new IStatus[results.size()]);
+ LocalZippedPublisherUtil util = new LocalZippedPublisherUtil();
+ return util.publishModule(server, deployRoot, module, publishType, delta, monitor);
}
-
-
- protected IStatus[] copy(de.schlichtherle.io.File root, IModuleResource[] children) {
- ArrayList<IStatus> results = new ArrayList<IStatus>();
- for( int i = 0; i < children.length; i++ ) {
- if( children[i] instanceof IModuleFile ) {
- IModuleFile mf = (IModuleFile)children[i];
- java.io.File source = getFile(mf);
- de.schlichtherle.io.File destination = getFileInArchive(root, mf.getModuleRelativePath().append(mf.getName()));
- boolean b = new de.schlichtherle.io.File(source).copyAllTo(destination);
- if( !b )
- results.add(generateCopyFailStatus(source, destination));
- } else if( children[i] instanceof IModuleFolder ) {
- de.schlichtherle.io.File destination = getFileInArchive(root, children[i].getModuleRelativePath().append(children[i].getName()));
- destination.mkdirs();
- IModuleFolder mf = (IModuleFolder)children[i];
- results.addAll(Arrays.asList(copy(root, mf.members())));
- }
- }
- return (IStatus[]) results.toArray(new IStatus[results.size()]);
- }
-
- protected IStatus generateDeleteFailedStatus(java.io.File file) {
- return new Status(IStatus.ERROR, IntegrationPlugin.PLUGIN_ID, "Could not delete file " + file); //$NON-NLS-1$
- }
- protected IStatus generateCoreExceptionStatus(CoreException ce) {
- return new Status(IStatus.ERROR, IntegrationPlugin.PLUGIN_ID, ce.getMessage(), ce);
- }
- protected IStatus generateCopyFailStatus(java.io.File source, java.io.File destination) {
- return new Status(IStatus.ERROR, IntegrationPlugin.PLUGIN_ID, "Copy of " + source + " to " + destination + " has failed");//$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
- }
-
- protected de.schlichtherle.io.File getFileInArchive(de.schlichtherle.io.File root, IPath relative) {
- while(relative.segmentCount() > 0 ) {
- root = new de.schlichtherle.io.File(root,
- relative.segment(0), ArchiveDetector.DEFAULT);
- relative = relative.removeFirstSegments(1);
- }
- return root;
- }
-
- private IModule[] combine(IModule[] module, IModule newMod) {
- IModule[] retval = new IModule[module.length + 1];
- for( int i = 0; i < module.length; i++ )
- retval[i]=module[i];
- retval[retval.length-1] = newMod;
- return retval;
- }
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/ExtensionManager.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/ExtensionManager.java 2009-10-19 17:21:45 UTC (rev 18170)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/ExtensionManager.java 2009-10-19 21:52:18 UTC (rev 18171)
@@ -153,17 +153,18 @@
return null;
}
- public IJBossServerPublisher getZippedPublisher() {
+ public IJBossServerPublisher[] getZippedPublishers() {
if( publishers == null )
loadPublishers();
+ ArrayList<IJBossServerPublisher> list = new ArrayList<IJBossServerPublisher>();
Iterator<PublisherWrapper> i = publishers.iterator();
PublisherWrapper wrapper;
while(i.hasNext()) {
wrapper = i.next();
if( wrapper.isZipDelegate )
- return wrapper.getNewInstance();
+ list.add( wrapper.getNewInstance() );
}
- return null;
+ return list.toArray(new IJBossServerPublisher[list.size()]);
}
private void loadPublishers() {
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java 2009-10-19 17:21:45 UTC (rev 18170)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java 2009-10-19 21:52:18 UTC (rev 18171)
@@ -33,11 +33,11 @@
import org.eclipse.wst.server.core.model.IModuleResource;
import org.eclipse.wst.server.core.model.IModuleResourceDelta;
import org.eclipse.wst.server.core.util.ProjectModule;
-import org.jboss.ide.eclipse.as.core.ExtensionManager;
import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
import org.jboss.ide.eclipse.as.core.Messages;
import org.jboss.ide.eclipse.as.core.extensions.events.IEventCodes;
import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerPublishMethod;
import org.jboss.ide.eclipse.as.core.server.IJBossServerPublisher;
import org.jboss.ide.eclipse.as.core.server.xpl.ModulePackager;
import org.jboss.ide.eclipse.as.core.server.xpl.PublishCopyUtil;
@@ -65,26 +65,23 @@
public JstPublisher() {
}
- private boolean serverRequiresZips() {
- return server.zipsWTPDeployments();
+ public boolean accepts(String type, IServer server, IModule[] module) {
+ IDeployableServer ds = ServerConverter.getDeployableServer(server);
+ boolean shouldAccept = ds != null && LocalPublishMethod.LOCAL_PUBLISH_METHOD.equals(type)
+ && ModuleCoreNature.isFlexibleProject(module[0].getProject())
+ && ds.zipsWTPDeployments();
+ return shouldAccept;
}
- public IStatus publishModule(IServer server, IModule[] module,
- int publishType, IModuleResourceDelta[] delta, IProgressMonitor monitor) throws CoreException {
+ public IStatus publishModule(
+ IJBossServerPublishMethod method,
+ IServer server, IModule[] module,
+ int publishType, IModuleResourceDelta[] delta,
+ IProgressMonitor monitor) throws CoreException {
IStatus status = null;
this.server = ServerConverter.getDeployableServer(server);
this.delta = delta;
- if( serverRequiresZips() ) {
- IJBossServerPublisher delegate =
- ExtensionManager.getDefault().getZippedPublisher();
- if( delegate != null ) {
- return delegate.publishModule(server, module, publishType, delta, monitor);
- } else {
- // TODO log, use unzipped instead
- }
- }
-
boolean deleted = false;
for( int i = 0; i < module.length; i++ ) {
if( module[i].isExternal() )
@@ -319,8 +316,4 @@
}
}
}
- public boolean accepts(String type, IServer server, IModule[] module) {
- return "local".equals(type) && //$NON-NLS-1$
- ModuleCoreNature.isFlexibleProject(module[0].getProject());
- }
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/LocalPublishMethod.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/LocalPublishMethod.java 2009-10-19 17:21:45 UTC (rev 18170)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/LocalPublishMethod.java 2009-10-19 21:52:18 UTC (rev 18171)
@@ -14,9 +14,14 @@
import org.jboss.ide.eclipse.as.core.server.internal.DeployableServerBehavior;
public class LocalPublishMethod implements IJBossServerPublishMethod {
-
+ public static final String LOCAL_PUBLISH_METHOD = "local"; //$NON-NLS-1$
+
+ public String getPublishMethodId() {
+ return LOCAL_PUBLISH_METHOD;
+ }
+
public boolean accepts(String methodType) {
- return "local".equals(methodType); //$NON-NLS-1$
+ return getPublishMethodId().equals(methodType);
}
public void publishStart(DeployableServerBehavior behaviour,
@@ -58,12 +63,14 @@
// Let the publisher decide what to do
if( module.length > 0 ) {
- publisher = ExtensionManager.getDefault().getPublisher(behaviour.getServer(), module, "local"); //$NON-NLS-1$
+ publisher = ExtensionManager.getDefault().getPublisher(behaviour.getServer(), module, getPublishMethodId());
IModuleResourceDelta[] deltas = new IModuleResourceDelta[]{};
if( deltaKind != ServerBehaviourDelegate.REMOVED)
deltas = behaviour.getPublishedResourceDelta(module);
if( publisher != null ) {
- IStatus result = publisher.publishModule(behaviour.getServer(), module,
+ IStatus result = publisher.publishModule(
+ this,
+ behaviour.getServer(), module,
publishType, deltas, monitor);
if( result != null )
ServerLogger.getDefault().log(behaviour.getServer(), result);
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/NullPublisher.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/NullPublisher.java 2009-10-19 17:21:45 UTC (rev 18170)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/NullPublisher.java 2009-10-19 21:52:18 UTC (rev 18171)
@@ -21,6 +21,7 @@
import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
import org.jboss.ide.eclipse.as.core.Messages;
import org.jboss.ide.eclipse.as.core.extensions.events.IEventCodes;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerPublishMethod;
import org.jboss.ide.eclipse.as.core.server.IJBossServerPublisher;
/**
@@ -36,8 +37,11 @@
return true;
}
- public IStatus publishModule(IServer server, IModule[] module,
- int publishType, IModuleResourceDelta[] delta, IProgressMonitor monitor) throws CoreException {
+ public IStatus publishModule(
+ IJBossServerPublishMethod method,
+ IServer server, IModule[] module,
+ int publishType, IModuleResourceDelta[] delta,
+ IProgressMonitor monitor) throws CoreException {
return new Status(IStatus.WARNING, JBossServerCorePlugin.PLUGIN_ID,
IEventCodes.NO_PUBLISHER_ROOT_CODE,
NLS.bind(Messages.NoPublisherFound, module[module.length-1]), null);
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/PublishUtil.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/PublishUtil.java 2009-10-19 17:21:45 UTC (rev 18170)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/PublishUtil.java 2009-10-19 21:52:18 UTC (rev 18171)
@@ -65,7 +65,7 @@
return count;
}
- private static String getDeployRootFolder(IModule[] moduleTree,
+ public static String getDeployRootFolder(IModule[] moduleTree,
IDeployableServer server, String defaultFolder, String moduleProperty) {
String folder = defaultFolder;
// TODO bug 286699
@@ -110,7 +110,7 @@
return new Path(folder);
}
- private static IPath getDeployPath(IModule[] moduleTree, String deployFolder) {
+ public static IPath getDeployPath(IModule[] moduleTree, String deployFolder) {
IPath root = new Path( deployFolder );
String type, modName, name, uri, suffixedName;
for( int i = 0; i < moduleTree.length; i++ ) {
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/SingleFilePublisher.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/SingleFilePublisher.java 2009-10-19 17:21:45 UTC (rev 18170)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/SingleFilePublisher.java 2009-10-19 21:52:18 UTC (rev 18171)
@@ -18,7 +18,6 @@
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.osgi.util.NLS;
import org.eclipse.wst.server.core.IModule;
@@ -30,6 +29,7 @@
import org.jboss.ide.eclipse.as.core.modules.SingleDeployableFactory;
import org.jboss.ide.eclipse.as.core.modules.SingleDeployableFactory.SingleDeployableModuleDelegate;
import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerPublishMethod;
import org.jboss.ide.eclipse.as.core.server.IJBossServerPublisher;
import org.jboss.ide.eclipse.as.core.util.FileUtil;
import org.jboss.ide.eclipse.as.core.util.ServerConverter;
@@ -47,15 +47,19 @@
}
public boolean accepts(String method, IServer server, IModule[] module) {
- if( "local".equals(method) && module != null && module.length > 0 //$NON-NLS-1$
+ if( LocalPublishMethod.LOCAL_PUBLISH_METHOD.equals(method)
+ && module != null && module.length > 0
&& module[module.length-1] != null
&& module[module.length-1].getModuleType().getId().equals(SingleDeployableFactory.MODULE_TYPE))
return true;
return false;
}
- public IStatus publishModule(IServer server, IModule[] module,
- int publishType, IModuleResourceDelta[] delta, IProgressMonitor monitor) throws CoreException {
+ public IStatus publishModule(
+ IJBossServerPublishMethod method,
+ IServer server, IModule[] module,
+ int publishType, IModuleResourceDelta[] delta,
+ IProgressMonitor monitor) throws CoreException {
this.server = ServerConverter.getDeployableServer(server);
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IJBossServerPublishMethod.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IJBossServerPublishMethod.java 2009-10-19 17:21:45 UTC (rev 18170)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IJBossServerPublishMethod.java 2009-10-19 21:52:18 UTC (rev 18171)
@@ -6,6 +6,7 @@
import org.jboss.ide.eclipse.as.core.server.internal.DeployableServerBehavior;
public interface IJBossServerPublishMethod {
+ public String getPublishMethodId();
public boolean accepts(String methodType);
public void publishStart(DeployableServerBehavior behaviour, IProgressMonitor monitor) throws CoreException;
public int publishFinish(DeployableServerBehavior behaviour, IProgressMonitor monitor) throws CoreException;
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IJBossServerPublisher.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IJBossServerPublisher.java 2009-10-19 17:21:45 UTC (rev 18170)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IJBossServerPublisher.java 2009-10-19 21:52:18 UTC (rev 18171)
@@ -33,6 +33,9 @@
public boolean accepts(String method, IServer server, IModule[] module);
// post publish
public int getPublishState();
- public IStatus publishModule(IServer server, IModule[] module,
- int publishType, IModuleResourceDelta[] delta, IProgressMonitor monitor) throws CoreException;
+ public IStatus publishModule(
+ IJBossServerPublishMethod method,
+ IServer server, IModule[] module,
+ int publishType, IModuleResourceDelta[] delta,
+ IProgressMonitor monitor) throws CoreException;
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DeployableServerBehavior.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DeployableServerBehavior.java 2009-10-19 17:21:45 UTC (rev 18170)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DeployableServerBehavior.java 2009-10-19 21:52:18 UTC (rev 18171)
@@ -14,6 +14,8 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.wst.server.core.IModule;
import org.eclipse.wst.server.core.IServer;
@@ -21,6 +23,7 @@
import org.eclipse.wst.server.core.ServerEvent;
import org.eclipse.wst.server.core.model.IModuleResourceDelta;
import org.eclipse.wst.server.core.model.ServerBehaviourDelegate;
+import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
import org.jboss.ide.eclipse.as.core.publishers.LocalPublishMethod;
import org.jboss.ide.eclipse.as.core.server.IJBossServerPublishMethod;
import org.jboss.ide.eclipse.as.core.server.IJBossServerPublisher;
@@ -39,24 +42,31 @@
workingCopy.setAttribute(DeployableLaunchConfiguration.ACTION_KEY, DeployableLaunchConfiguration.START);
}
+
+ protected IJBossServerPublishMethod method;
protected void publishStart(IProgressMonitor monitor) throws CoreException {
- IJBossServerPublishMethod method = getPublishMethod();
+ if( method != null )
+ throw new CoreException(new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID, "Already publishing")); //$NON-NLS-1$
+ method = createPublishMethod();
method.publishStart(this, monitor);
}
protected void publishFinish(IProgressMonitor monitor) throws CoreException {
- IJBossServerPublishMethod method = getPublishMethod();
+ if( method == null )
+ throw new CoreException(new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID, "Not publishing")); //$NON-NLS-1$
int result = method.publishFinish(this, monitor);
setServerPublishState(result);
+ method = null;
}
protected void publishModule(int kind, int deltaKind, IModule[] module, IProgressMonitor monitor) throws CoreException {
- IJBossServerPublishMethod method = getPublishMethod();
+ if( method == null )
+ throw new CoreException(new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID, "Not publishing")); //$NON-NLS-1$
int result = method.publishModule(this, kind, deltaKind, module, monitor);
setModulePublishState(module, result);
}
- protected IJBossServerPublishMethod getPublishMethod() {
+ protected IJBossServerPublishMethod createPublishMethod() {
return new LocalPublishMethod(); // TODO FIX THIS
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/xpl/PublishCopyUtil.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/xpl/PublishCopyUtil.java 2009-10-19 17:21:45 UTC (rev 18170)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/xpl/PublishCopyUtil.java 2009-10-19 21:52:18 UTC (rev 18171)
@@ -156,7 +156,7 @@
* reporting and cancellation are not desired
* @return a possibly-empty array of error and warning status
*/
- public IStatus[] deleteDirectory(File dir, IProgressMonitor monitor) {
+ private IStatus[] deleteDirectory(File dir, IProgressMonitor monitor) {
if (!dir.exists() || !dir.isDirectory())
return new IStatus[] { new Status(IStatus.ERROR, ServerPlugin.PLUGIN_ID, 0, NLS.bind(Messages.errorNotADirectory, dir.getAbsolutePath()), null) };
@@ -203,17 +203,7 @@
/**
* Smart copy the given module resources to the given path.
*
- * @param resources an array of module resources
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting and cancellation are not desired
- * @return a possibly-empty array of error and warning status
- */
- public IStatus[] publishSmart(IModuleResource[] resources, IProgressMonitor monitor) {
- return publishSmart(resources, rootDeploy, monitor);
- }
-
- /**
- * Smart copy the given module resources to the given path.
+ * Not yet used
*
* @param resources an array of module resources
* @param path an external path to copy to
@@ -221,149 +211,149 @@
* reporting and cancellation are not desired
* @return a possibly-empty array of error and warning status
*/
- private IStatus[] publishSmart(IModuleResource[] resources, IPath path, IProgressMonitor monitor) {
- if (resources == null)
- return EMPTY_STATUS;
-
- monitor = ProgressUtil.getMonitorFor(monitor);
-
- List status = new ArrayList(2);
- File toDir = path.toFile();
- int fromSize = resources.length;
- String[] fromFileNames = new String[fromSize];
- for (int i = 0; i < fromSize; i++)
- fromFileNames[i] = resources[i].getName();
-
- // cache files and file names for performance
- File[] toFiles = null;
- String[] toFileNames = null;
-
- boolean foundExistingDir = false;
- if (toDir.exists()) {
- if (toDir.isDirectory()) {
- foundExistingDir = true;
- toFiles = toDir.listFiles();
- int toSize = toFiles.length;
- toFileNames = new String[toSize];
-
- // check if this exact file exists in the new directory
- for (int i = 0; i < toSize; i++) {
- toFileNames[i] = toFiles[i].getName();
- boolean isDir = toFiles[i].isDirectory();
- boolean found = false;
- for (int j = 0; j < fromSize; j++) {
- if (toFileNames[i].equals(fromFileNames[j]) && isDir == resources[j] instanceof IModuleFolder)
- found = true;
- }
-
- // delete file if it can't be found or isn't the correct type
- if (!found) {
- if (isDir) {
- IStatus[] stat = deleteDirectory(toFiles[i], null);
- addArrayToList(status, stat);
- } else {
- if (!toFiles[i].delete())
- status.add(new Status(IStatus.ERROR, ServerPlugin.PLUGIN_ID, 0, NLS.bind(Messages.errorDeleting, toFiles[i].getAbsolutePath()), null));
- }
- toFiles[i] = null;
- toFileNames[i] = null;
- }
- }
- } else { //if (toDir.isFile())
- if (!toDir.delete()) {
- status.add(new Status(IStatus.ERROR, ServerPlugin.PLUGIN_ID, 0, NLS.bind(Messages.errorDeleting, toDir.getAbsolutePath()), null));
- IStatus[] stat = new IStatus[status.size()];
- status.toArray(stat);
- return stat;
- }
- }
- }
- if (!foundExistingDir && !toDir.mkdirs()) {
- status.add(new Status(IStatus.ERROR, ServerPlugin.PLUGIN_ID, 0, NLS.bind(Messages.errorMkdir, toDir.getAbsolutePath()), null));
- IStatus[] stat = new IStatus[status.size()];
- status.toArray(stat);
- return stat;
- }
-
- if (monitor.isCanceled())
- return new IStatus[] { Status.CANCEL_STATUS };
-
- monitor.worked(50);
-
- // cycle through files and only copy when it doesn't exist
- // or is newer
- if (toFiles == null)
- toFiles = toDir.listFiles();
- int toSize = 0;
- if (toFiles != null)
- toSize = toFiles.length;
-
- int dw = 0;
- if (toSize > 0)
- dw = 500 / toSize;
-
- // cache file names and last modified dates for performance
- if (toFileNames == null)
- toFileNames = new String[toSize];
- long[] toFileMod = new long[toSize];
- for (int i = 0; i < toSize; i++) {
- if (toFiles[i] != null) {
- if (toFileNames[i] != null)
- toFileNames[i] = toFiles[i].getName();
- toFileMod[i] = toFiles[i].lastModified();
- }
- }
-
- for (int i = 0; i < fromSize; i++) {
- IModuleResource current = resources[i];
- String name = fromFileNames[i];
- boolean currentIsDir = current instanceof IModuleFolder;
-
- if (!currentIsDir) {
- // check if this is a new or newer file
- boolean copy = true;
- IModuleFile mf = (IModuleFile) current;
-
- long mod = -1;
- IFile file = (IFile) mf.getAdapter(IFile.class);
- if (file != null) {
- mod = file.getLocalTimeStamp();
- } else {
- File file2 = (File) mf.getAdapter(File.class);
- mod = file2.lastModified();
- }
-
- for (int j = 0; j < toSize; j++) {
- if (name.equals(toFileNames[j]) && mod == toFileMod[j])
- copy = false;
- }
-
- if (copy) {
- try {
- copyFile(mf, path.append(name));
- } catch (CoreException ce) {
- status.add(ce.getStatus());
- }
- }
- monitor.worked(dw);
- } else { //if (currentIsDir) {
- IModuleFolder folder = (IModuleFolder) current;
- IModuleResource[] children = folder.members();
- monitor.subTask(NLS.bind(Messages.copyingTask, new String[] {name, name}));
- IStatus[] stat = publishSmart(children, path.append(name), ProgressUtil.getSubMonitorFor(monitor, dw));
- addArrayToList(status, stat);
- }
- }
- if (monitor.isCanceled())
- return new IStatus[] { Status.CANCEL_STATUS };
-
- monitor.worked(500 - dw * toSize);
- monitor.done();
-
- IStatus[] stat = new IStatus[status.size()];
- status.toArray(stat);
- return stat;
- }
+// private IStatus[] publishSmart(IModuleResource[] resources, IPath path, IProgressMonitor monitor) {
+// if (resources == null)
+// return EMPTY_STATUS;
+//
+// monitor = ProgressUtil.getMonitorFor(monitor);
+//
+// List status = new ArrayList(2);
+// File toDir = path.toFile();
+// int fromSize = resources.length;
+// String[] fromFileNames = new String[fromSize];
+// for (int i = 0; i < fromSize; i++)
+// fromFileNames[i] = resources[i].getName();
+//
+// // cache files and file names for performance
+// File[] toFiles = null;
+// String[] toFileNames = null;
+//
+// boolean foundExistingDir = false;
+// if (toDir.exists()) {
+// if (toDir.isDirectory()) {
+// foundExistingDir = true;
+// toFiles = toDir.listFiles();
+// int toSize = toFiles.length;
+// toFileNames = new String[toSize];
+//
+// // check if this exact file exists in the new directory
+// for (int i = 0; i < toSize; i++) {
+// toFileNames[i] = toFiles[i].getName();
+// boolean isDir = toFiles[i].isDirectory();
+// boolean found = false;
+// for (int j = 0; j < fromSize; j++) {
+// if (toFileNames[i].equals(fromFileNames[j]) && isDir == resources[j] instanceof IModuleFolder)
+// found = true;
+// }
+//
+// // delete file if it can't be found or isn't the correct type
+// if (!found) {
+// if (isDir) {
+// IStatus[] stat = deleteDirectory(toFiles[i], null);
+// addArrayToList(status, stat);
+// } else {
+// if (!toFiles[i].delete())
+// status.add(new Status(IStatus.ERROR, ServerPlugin.PLUGIN_ID, 0, NLS.bind(Messages.errorDeleting, toFiles[i].getAbsolutePath()), null));
+// }
+// toFiles[i] = null;
+// toFileNames[i] = null;
+// }
+// }
+// } else { //if (toDir.isFile())
+// if (!toDir.delete()) {
+// status.add(new Status(IStatus.ERROR, ServerPlugin.PLUGIN_ID, 0, NLS.bind(Messages.errorDeleting, toDir.getAbsolutePath()), null));
+// IStatus[] stat = new IStatus[status.size()];
+// status.toArray(stat);
+// return stat;
+// }
+// }
+// }
+// if (!foundExistingDir && !toDir.mkdirs()) {
+// status.add(new Status(IStatus.ERROR, ServerPlugin.PLUGIN_ID, 0, NLS.bind(Messages.errorMkdir, toDir.getAbsolutePath()), null));
+// IStatus[] stat = new IStatus[status.size()];
+// status.toArray(stat);
+// return stat;
+// }
+//
+// if (monitor.isCanceled())
+// return new IStatus[] { Status.CANCEL_STATUS };
+//
+// monitor.worked(50);
+//
+// // cycle through files and only copy when it doesn't exist
+// // or is newer
+// if (toFiles == null)
+// toFiles = toDir.listFiles();
+// int toSize = 0;
+// if (toFiles != null)
+// toSize = toFiles.length;
+//
+// int dw = 0;
+// if (toSize > 0)
+// dw = 500 / toSize;
+//
+// // cache file names and last modified dates for performance
+// if (toFileNames == null)
+// toFileNames = new String[toSize];
+// long[] toFileMod = new long[toSize];
+// for (int i = 0; i < toSize; i++) {
+// if (toFiles[i] != null) {
+// if (toFileNames[i] != null)
+// toFileNames[i] = toFiles[i].getName();
+// toFileMod[i] = toFiles[i].lastModified();
+// }
+// }
+//
+// for (int i = 0; i < fromSize; i++) {
+// IModuleResource current = resources[i];
+// String name = fromFileNames[i];
+// boolean currentIsDir = current instanceof IModuleFolder;
+//
+// if (!currentIsDir) {
+// // check if this is a new or newer file
+// boolean copy = true;
+// IModuleFile mf = (IModuleFile) current;
+//
+// long mod = -1;
+// IFile file = (IFile) mf.getAdapter(IFile.class);
+// if (file != null) {
+// mod = file.getLocalTimeStamp();
+// } else {
+// File file2 = (File) mf.getAdapter(File.class);
+// mod = file2.lastModified();
+// }
+//
+// for (int j = 0; j < toSize; j++) {
+// if (name.equals(toFileNames[j]) && mod == toFileMod[j])
+// copy = false;
+// }
+//
+// if (copy) {
+// try {
+// copyFile(mf, path.append(name));
+// } catch (CoreException ce) {
+// status.add(ce.getStatus());
+// }
+// }
+// monitor.worked(dw);
+// } else { //if (currentIsDir) {
+// IModuleFolder folder = (IModuleFolder) current;
+// IModuleResource[] children = folder.members();
+// monitor.subTask(NLS.bind(Messages.copyingTask, new String[] {name, name}));
+// IStatus[] stat = publishSmart(children, path.append(name), ProgressUtil.getSubMonitorFor(monitor, dw));
+// addArrayToList(status, stat);
+// }
+// }
+// if (monitor.isCanceled())
+// return new IStatus[] { Status.CANCEL_STATUS };
+//
+// monitor.worked(500 - dw * toSize);
+// monitor.done();
+//
+// IStatus[] stat = new IStatus[status.size()];
+// status.toArray(stat);
+// return stat;
+// }
/**
* Handle a delta publish.
@@ -539,118 +529,6 @@
}
/**
- * Creates a new zip file containing the given module resources. Deletes the existing file
- * (and doesn't create a new one) if resources is null or empty.
- *
- * @param resources an array of module resources
- * @param path the path where the zip file should be created
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting and cancellation are not desired
- * @return a possibly-empty array of error and warning status
- */
- public IStatus[] publishZip(IModuleResource[] resources, IPath path, IProgressMonitor monitor) {
- if (resources == null || resources.length == 0) {
- // should also check if resources consists of all empty directories
- File file = path.toFile();
- if (file.exists())
- file.delete();
- return EMPTY_STATUS;
- }
-
- monitor = ProgressUtil.getMonitorFor(monitor);
-
- File tempFile = null;
- try {
- File file = path.toFile();
- tempFile = File.createTempFile(TEMPFILE_PREFIX, "." + path.getFileExtension(), getTempFolder()); //$NON-NLS-1$
- BufferedOutputStream bout = new BufferedOutputStream(new FileOutputStream(tempFile));
- ZipOutputStream zout = new ZipOutputStream(bout);
- addZipEntries(zout, resources);
- zout.close();
-
- moveTempFile(tempFile, file);
- } catch (CoreException e) {
- return new IStatus[] { e.getStatus() };
- } catch (Exception e) {
- //Trace.trace(Trace.SEVERE, "Error zipping", e);
- return new Status[] { new Status(IStatus.ERROR, ServerPlugin.PLUGIN_ID, 0, NLS.bind(Messages.errorCreatingZipFile, path.lastSegment(), e.getLocalizedMessage()), e) };
- } finally {
- if (tempFile != null && tempFile.exists())
- tempFile.deleteOnExit();
- }
- return EMPTY_STATUS;
- }
-
- private void addZipEntries(ZipOutputStream zout, IModuleResource[] resources) throws Exception {
- if (resources == null)
- return;
-
- int size = resources.length;
- for (int i = 0; i < size; i++) {
- if (resources[i] instanceof IModuleFolder) {
- IModuleFolder mf = (IModuleFolder) resources[i];
- IModuleResource[] res = mf.members();
-
- IPath path = mf.getModuleRelativePath().append(mf.getName());
- String entryPath = path.toPortableString();
- if (!entryPath.endsWith("/")) //$NON-NLS-1$
- entryPath += '/';
-
- ZipEntry ze = new ZipEntry(entryPath);
-
- long ts = 0;
- IContainer folder = (IContainer) mf.getAdapter(IContainer.class);
- if (folder != null)
- ts = folder.getLocalTimeStamp();
-
- if (ts != IResource.NULL_STAMP && ts != 0)
- ze.setTime(ts);
-
- zout.putNextEntry(ze);
- zout.closeEntry();
-
- addZipEntries(zout, res);
- continue;
- }
-
- IModuleFile mf = (IModuleFile) resources[i];
- IPath path = mf.getModuleRelativePath().append(mf.getName());
-
- ZipEntry ze = new ZipEntry(path.toPortableString());
-
- InputStream in = null;
- long ts = 0;
- IFile file = (IFile) mf.getAdapter(IFile.class);
- if (file != null) {
- ts = file.getLocalTimeStamp();
- in = file.getContents();
- } else {
- File file2 = (File) mf.getAdapter(File.class);
- ts = file2.lastModified();
- in = new FileInputStream(file2);
- }
-
- if (ts != IResource.NULL_STAMP && ts != 0)
- ze.setTime(ts);
-
- zout.putNextEntry(ze);
-
- try {
- int n = 0;
- while (n > -1) {
- n = in.read(buf);
- if (n > 0)
- zout.write(buf, 0, n);
- }
- } finally {
- in.close();
- }
-
- zout.closeEntry();
- }
- }
-
- /**
* Utility method to move a temp file into position by deleting the original and
* swapping in a new copy.
*
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/META-INF/MANIFEST.MF 2009-10-19 17:21:45 UTC (rev 18170)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/META-INF/MANIFEST.MF 2009-10-19 21:52:18 UTC (rev 18171)
@@ -51,6 +51,7 @@
Export-Package: org.jboss.ide.eclipse.as.ui,
org.jboss.ide.eclipse.as.ui.dialogs,
org.jboss.ide.eclipse.as.ui.views.server.extensions,
+ org.jboss.ide.eclipse.as.ui.editor,
org.jboss.ide.eclipse.as.ui.wizards,
org.jboss.tools.as.wst.server.ui.xpl
Bundle-Activator: org.jboss.ide.eclipse.as.ui.JBossServerUIPlugin
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/LocalDeploymentModuleTab.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/LocalDeploymentModuleTab.java 2009-10-19 17:21:45 UTC (rev 18170)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/LocalDeploymentModuleTab.java 2009-10-19 21:52:18 UTC (rev 18171)
@@ -43,8 +43,10 @@
import org.eclipse.wst.server.ui.internal.command.ServerCommand;
import org.jboss.ide.eclipse.as.core.ExtensionManager;
import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
+import org.jboss.ide.eclipse.as.core.publishers.LocalPublishMethod;
import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
import org.jboss.ide.eclipse.as.core.server.IJBossServerConstants;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerPublisher;
import org.jboss.ide.eclipse.as.core.server.IJBossServerRuntime;
import org.jboss.ide.eclipse.as.core.server.internal.ServerAttributeHelper;
import org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants;
@@ -290,11 +292,10 @@
zipDeployWTPProjects = toolkit.createButton(composite,
Messages.EditorZipDeployments, SWT.CHECK);
- boolean publisherAvailable = ExtensionManager.getDefault()
- .getZippedPublisher() != null;
+ boolean zippedPublisherAvailable = isLocalZippedPublisherAvailable();
boolean value = getServer().zipsWTPDeployments();
- zipDeployWTPProjects.setEnabled(publisherAvailable);
- zipDeployWTPProjects.setSelection(publisherAvailable && value);
+ zipDeployWTPProjects.setEnabled(zippedPublisherAvailable);
+ zipDeployWTPProjects.setSelection(zippedPublisherAvailable && value);
FormData zipButtonData = new FormData();
zipButtonData.right = new FormAttachment(100, -5);
@@ -319,6 +320,16 @@
return section;
}
+ protected boolean isLocalZippedPublisherAvailable() {
+ IJBossServerPublisher[] publishers =
+ ExtensionManager.getDefault().getZippedPublishers();
+ for( int i = 0; i < publishers.length; i++ ) {
+ if( publishers[i].accepts(LocalPublishMethod.LOCAL_PUBLISH_METHOD, getServer().getServer(), null))
+ return true;
+ }
+ return false;
+ }
+
public class SetDeployDirCommand extends ServerCommand {
private String oldDir;
private String newDir;
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ModuleDeploymentPage.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ModuleDeploymentPage.java 2009-10-19 17:21:45 UTC (rev 18170)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ModuleDeploymentPage.java 2009-10-19 21:52:18 UTC (rev 18171)
@@ -34,11 +34,11 @@
import org.jboss.ide.eclipse.as.core.util.DeploymentPreferenceLoader.DeploymentPreferences;
public class ModuleDeploymentPage extends ServerEditorPart {
- private ServerResourceCommandManager commandManager;
- private ArrayList<IModule> possibleModules;
- private DeploymentPreferences preferences;
- private ArrayList<IDeploymentEditorTab> tabs;
- private ServerAttributeHelper helper;
+ protected ServerResourceCommandManager commandManager;
+ protected ArrayList<IModule> possibleModules;
+ protected DeploymentPreferences preferences;
+ protected ArrayList<IDeploymentEditorTab> tabs;
+ protected ServerAttributeHelper helper;
public IModule[] getPossibleModules() {
return (IModule[]) possibleModules.toArray(new IModule[possibleModules.size()]);
@@ -92,18 +92,24 @@
toolkit.adapt(tabFolder);
toolkit.adapt(form);
toolkit.adapt(form.getBody());
- // for loop {
- TabItem tabItem = new TabItem(tabFolder, SWT.NULL);
- IDeploymentEditorTab tab = new LocalDeploymentModuleTab();
- tabItem.setText(tab.getTabName());
- tab.setDeploymentPage(this);
- tab.setDeploymentPrefs(preferences);
- tabItem.setControl(tab.createControl(tabFolder));
- toolkit.adapt((Composite)tabItem.getControl());
- tabs.add(tab);
- // }
+ IDeploymentEditorTab[] newItems = createTabs(toolkit, tabFolder);
+ for( int i = 0; i < newItems.length; i++ ) {
+ tabs.add(newItems[i]);
+ }
}
+ protected IDeploymentEditorTab[] createTabs(FormToolkit toolkit, TabFolder tabFolder) {
+ TabItem tabItem = new TabItem(tabFolder, SWT.NULL);
+ IDeploymentEditorTab tab = new LocalDeploymentModuleTab();
+ tabItem.setText(tab.getTabName());
+ tab.setDeploymentPage(this);
+ tab.setDeploymentPrefs(preferences);
+ tabItem.setControl(tab.createControl(tabFolder));
+ toolkit.adapt((Composite)tabItem.getControl());
+
+ return new IDeploymentEditorTab[] { tab };
+ }
+
public void execute(ServerCommand command) {
commandManager.execute(command);
}
14 years, 8 months
JBoss Tools SVN: r18170 - in trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb: include and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2009-10-19 13:21:45 -0400 (Mon, 19 Oct 2009)
New Revision: 18170
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/ICSSContainerSupport.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/IIncludedContextSupport.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/include/IncludeContextBuilder.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/include/IncludeContextDefinition.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/CSSClassProposalType.java
Log:
JBIDE-3563: Code assist for "class" and "styleClass" attributes for html and jsf tags.
Minor changes (commented)
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/ICSSContainerSupport.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/ICSSContainerSupport.java 2009-10-19 17:04:32 UTC (rev 18169)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/ICSSContainerSupport.java 2009-10-19 17:21:45 UTC (rev 18170)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.jboss.tools.jst.web.kb;
import java.util.List;
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/IIncludedContextSupport.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/IIncludedContextSupport.java 2009-10-19 17:04:32 UTC (rev 18169)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/IIncludedContextSupport.java 2009-10-19 17:21:45 UTC (rev 18170)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.jboss.tools.jst.web.kb;
import java.util.List;
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/include/IncludeContextBuilder.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/include/IncludeContextBuilder.java 2009-10-19 17:04:32 UTC (rev 18169)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/include/IncludeContextBuilder.java 2009-10-19 17:21:45 UTC (rev 18170)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.jboss.tools.jst.web.kb.include;
import java.util.ArrayList;
@@ -7,9 +17,15 @@
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.Platform;
import org.eclipse.ui.internal.registry.RegistryReader;
-
import org.jboss.tools.jst.web.kb.WebKbPlugin;
+/**
+ * Include Context Builder is used to read and store the information from the
+ * Include schema.
+ *
+ * @author Victor Rubezhny
+ *
+ */
public class IncludeContextBuilder extends RegistryReader {
// extension point ID
public static final String PL_INCLUDE = "KbIncludeContext"; //$NON-NLS-1$
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/include/IncludeContextDefinition.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/include/IncludeContextDefinition.java 2009-10-19 17:04:32 UTC (rev 18169)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/include/IncludeContextDefinition.java 2009-10-19 17:21:45 UTC (rev 18170)
@@ -1,33 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.jboss.tools.jst.web.kb.include;
-import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.List;
import java.util.Map;
import java.util.Set;
import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.ui.internal.EarlyStartupRunnable;
+/**
+ * IncludeContextDefinition is used to store the definitions read from the Include Schema
+ *
+ * @author Victor Rubezhny
+ *
+ */
public class IncludeContextDefinition {
private String fUri;
private Map<String, Set<String>> fIncludeTags; // Map<TagName, Set<AttributeName>>
private Map<String, Set<String>> fCSSTags; // Map<TagName, Set<AttributeName>>
private Map<String, Set<String>> fContexts; // Map<ContextType, Set<ContentType>>
+ /**
+ * Created the IncludeContextDefinition object for the specified URI
+ *
+ * @param uri
+ */
public IncludeContextDefinition(String uri) {
this.fUri = uri;
}
+ /**
+ * Returns the URI for this IncludeContextDefinition object
+ *
+ * @return
+ */
public String getUri() {
return fUri;
}
+ /**
+ * Sets up the specified URI for this IncludeContextDefinition object
+ *
+ * @param uri
+ */
public void setUri(String uri) {
this.fUri = uri;
}
+ /**
+ * Adds a tag to the definition
+ *
+ * @param tagName
+ * @param element
+ * @return
+ */
public boolean addTag(String tagName, IConfigurationElement element) {
if ("".equals(fUri)) //$NON-NLS-1$
tagName = tagName.toLowerCase();
@@ -41,7 +76,13 @@
return false;
}
- public void addIncludeTag(String tagName, IConfigurationElement element) {
+ /**
+ * Adds an Include Tag to the Definition
+ *
+ * @param tagName
+ * @param element
+ */
+ private void addIncludeTag(String tagName, IConfigurationElement element) {
if (fIncludeTags == null) {
fIncludeTags = new HashMap<String, Set<String>>();
}
@@ -52,7 +93,13 @@
}
}
- public void addCSSTag(String tagName, IConfigurationElement element) {
+ /**
+ * Adds a CSS Style Sheet holder to the Definition
+ *
+ * @param tagName
+ * @param element
+ */
+ private void addCSSTag(String tagName, IConfigurationElement element) {
if (fCSSTags == null) {
fCSSTags = new HashMap<String, Set<String>>();
}
@@ -63,6 +110,12 @@
}
}
+ /**
+ * Adds a Tag Attribute to the Definition
+ *
+ * @param attributeName
+ * @param element
+ */
public void addTagAttribute(String attributeName, IConfigurationElement element) {
IConfigurationElement parentTagElement = null;
if (element.getParent() instanceof IConfigurationElement) {
@@ -95,6 +148,14 @@
}
}
+ /**
+ * Checks if the configuration element with the name specified exists in parents of the
+ * specified configuration element
+ *
+ * @param element
+ * @param elementName
+ * @return
+ */
private boolean isInParentElements(IConfigurationElement element, String elementName) {
Object parent = element.getParent();
while (parent instanceof IConfigurationElement) {
@@ -107,6 +168,12 @@
return false;
}
+ /**
+ * Adds a Context Type to the Definition
+ *
+ * @param id
+ * @param element
+ */
public void addContextType(String id, IConfigurationElement element) {
if (fContexts == null) {
fContexts = new HashMap<String, Set<String>>();
@@ -119,6 +186,13 @@
}
+ /**
+ * Adds a Content Type to the Definition
+ *
+ * @param id
+ * @param element
+ * @return
+ */
public boolean addContentType(String id, IConfigurationElement element) {
IConfigurationElement parentContextElement = null;
if (element.getParent() instanceof IConfigurationElement) {
@@ -142,17 +216,32 @@
private static final String[] EMPTY_CHILDREN = new String[0];
-
+ /**
+ * Returns the Include Tags stored in the Definition
+ *
+ * @return
+ */
public String[] getIncludeTags() {
return fIncludeTags == null ? EMPTY_CHILDREN :
(String[])fIncludeTags.keySet().toArray(new String[fIncludeTags.size()]);
}
+ /**
+ * Returns the CSS Style Sheet holder Tags stored in the Definition
+ *
+ * @return
+ */
public String[] getCSSTags() {
return fCSSTags == null ? EMPTY_CHILDREN :
(String[])fCSSTags.keySet().toArray(new String[fCSSTags.size()]);
}
+ /**
+ * Returns the Attributes for the Include Tag with the specified Name
+ *
+ * @param tagName
+ * @return
+ */
public String[] getIncludeTagAttributes(String tagName) {
if ("".equals(fUri)) //$NON-NLS-1$
tagName = tagName.toLowerCase();
@@ -163,6 +252,12 @@
(String[])attrSet.toArray(new String[attrSet.size()]);
}
+ /**
+ * Returns the Attributes for the CSS Style Sheet Holder Tag with the specified Name
+ *
+ * @param tagName
+ * @return
+ */
public String[] getCSSTagAttributes(String tagName) {
if ("".equals(fUri)) //$NON-NLS-1$
tagName = tagName.toLowerCase();
@@ -172,6 +267,13 @@
return attrSet == null ? EMPTY_CHILDREN :
(String[])attrSet.toArray(new String[attrSet.size()]);
}
+
+ /**
+ * Returns the ContextType for the specified Content Type
+ *
+ * @param contentType
+ * @return
+ */
public String getContextType(String contentType) {
if (fContexts == null)
return null;
@@ -182,5 +284,4 @@
}
return null;
}
-
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/CSSClassProposalType.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/CSSClassProposalType.java 2009-10-19 17:04:32 UTC (rev 18169)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/CSSClassProposalType.java 2009-10-19 17:21:45 UTC (rev 18170)
@@ -1,34 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.jboss.tools.jst.web.kb.internal.taglib;
import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Comparator;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.text.IDocument;
import org.eclipse.swt.graphics.Image;
import org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleRule;
-import org.eclipse.wst.sse.core.StructuredModelManager;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
import org.jboss.tools.common.text.TextProposal;
import org.jboss.tools.jst.web.kb.ICSSContainerSupport;
import org.jboss.tools.jst.web.kb.IPageContext;
import org.jboss.tools.jst.web.kb.KbQuery;
import org.jboss.tools.jst.web.kb.WebKbPlugin;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
import org.w3c.dom.css.CSSRule;
import org.w3c.dom.css.CSSRuleList;
import org.w3c.dom.css.CSSStyleSheet;
+/**
+ * The CSS Class proposal type. Is used to collect and return the proposals on
+ * the CSS classes
+ *
+ * @author Victor Rubezhny
+ *
+ */
public class CSSClassProposalType extends CustomProposalType {
private static final String IMAGE_NAME = "EnumerationProposal.gif"; //$NON-NLS-1$
private static Image ICON;
14 years, 8 months
JBoss Tools SVN: r18169 - trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/include.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2009-10-19 13:04:32 -0400 (Mon, 19 Oct 2009)
New Revision: 18169
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/include/IncludeContextBuilder.java
Log:
JBIDE-3563: Code assist for "class" and "styleClass" attributes for html and jsf tags.
Minor changes (commented)
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/include/IncludeContextBuilder.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/include/IncludeContextBuilder.java 2009-10-19 16:55:23 UTC (rev 18168)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/include/IncludeContextBuilder.java 2009-10-19 17:04:32 UTC (rev 18169)
@@ -33,9 +33,9 @@
private IncludeContextDefinition fCurrentIncludeDefinition = null;
/**
- * returns singleton instance of HyperlinkBuilder
+ * returns singleton instance of IncludeContextBuilder
*
- * @return HyperlinkBuilder
+ * @return {@link IncludeContextBuilder}
*/
public synchronized static IncludeContextBuilder getInstance() {
if (fInstance == null) {
@@ -56,11 +56,25 @@
return value;
}
+ /**
+ * Returns the URI of the part ID attribute that is expected
+ * in the target extension.
+ *
+ * @param element
+ * @return String
+ */
public static String getUri(IConfigurationElement element) {
String value = element.getAttribute(ATT_URI);
return value;
}
+ /**
+ * Returns the name of the part ID attribute that is expected
+ * in the target extension.
+ *
+ * @param element
+ * @return String
+ */
public static String getName(IConfigurationElement element) {
String value = element.getAttribute(ATT_NAME);
return value;
@@ -91,7 +105,13 @@
}
}
- IncludeContextDefinition getIncludeContextDefinition(String uri) {
+ /**
+ * Returns the IncludeContextDefinition by specified URI
+ *
+ * @param uri
+ * @return
+ */
+ private IncludeContextDefinition getIncludeContextDefinition(String uri) {
if (fIncludeContextDefs == null || uri == null)
return null;
@@ -104,6 +124,12 @@
return null;
}
+ /**
+ * Reads the Tag element and stores the specific data
+ *
+ * @param element
+ * @return
+ */
private boolean processTagElement(IConfigurationElement element) {
String theName = getName(element);
@@ -114,6 +140,12 @@
return false;
}
+ /**
+ * Reads the Tag Attribute element and stores the specific data
+ *
+ * @param element
+ * @return
+ */
private void processAttributeElement(IConfigurationElement element) {
String theName = getName(element);
@@ -122,6 +154,12 @@
}
}
+ /**
+ * Reads the ContextType element and stores the specific data
+ *
+ * @param element
+ * @return
+ */
private void processContextTypeElement(IConfigurationElement element) {
String theId = getId(element);
@@ -130,6 +168,12 @@
}
}
+ /**
+ * Reads the ContentType element and stores the specific data
+ *
+ * @param element
+ * @return
+ */
private boolean processContentTypeElement(IConfigurationElement element) {
String theId = getId(element);
@@ -148,7 +192,7 @@
if (tag.equals(TAG_INCLUDE) || tag.equals(TAG_CSSHOLDER)) {
processIncludeContextElement(element);
- // make sure processing of current open on tag resulted in a current open on definition
+ // make sure processing of current open on tag resulted in a current definition
// before continue reading the children
if (fCurrentIncludeDefinition != null) {
readElementChildren(element);
@@ -158,7 +202,7 @@
else if (tag.equals(TAG_TAG)) {
processTagElement(element);
- // make sure processing of current open on tag resulted in a current open on definition
+ // make sure processing of current open on tag resulted in a current definition
// before continue reading the children
if (fCurrentIncludeDefinition != null) {
readElementChildren(element);
@@ -172,7 +216,7 @@
else if (tag.equals(TAG_CONTEXTTYPE)) {
processContextTypeElement(element);
- // make sure processing of current open on tag resulted in a current open on definition
+ // make sure processing of current open on tag resulted in a current definition
// before continue reading the children
if (fCurrentIncludeDefinition != null) {
readElementChildren(element);
@@ -192,7 +236,12 @@
}
}
-
+ /**
+ * Reads the contributions defined in the extension point
+ *
+ * @param element
+ * @param extensionPoint
+ */
protected void readContributions(String element, String extensionPoint) {
fTargetContributionElement = element;
IExtensionRegistry registry = Platform.getExtensionRegistry();
@@ -201,6 +250,7 @@
/**
* Returns all the open on definition objects
+ *
* @return
*/
public List<IncludeContextDefinition> getIncludeContextDefinitions() {
@@ -208,6 +258,13 @@
return fIncludeContextDefs;
}
+ /**
+ * Returns the attributes for the specified include tag
+ *
+ * @param uri
+ * @param tagName
+ * @return
+ */
public static String[] getIncludeAttributes(String uri, String tagName) {
if (uri == null)
return null;
@@ -230,6 +287,12 @@
return attrs.size() == 0 ? null : attrs.toArray(new String[attrs.size()]);
}
+ /**
+ * Returns the Content Type for the specified Content Type
+ *
+ * @param contentType
+ * @return
+ */
public static String getContextType(String contentType) {
if (contentType == null)
return null;
@@ -247,6 +310,13 @@
return null;
}
+ /**
+ * Checks if the specified tag is a CSS Style Sheet container
+ *
+ * @param uri
+ * @param tagName
+ * @return
+ */
public static boolean isCSSStyleSheetContainer(String uri, String tagName) {
if (uri == null)
return false;
@@ -277,6 +347,13 @@
return isHolder;
}
+ /**
+ * Returns the CSS Style Sheet attributes that represent a CSS Style Sheet container
+ *
+ * @param uri
+ * @param tagName
+ * @return
+ */
public static String[] getCSSStyleSheetAttributes(String uri, String tagName) {
if (uri == null)
return null;
14 years, 8 months