You can subscribe to this list here.
| 2006 |
Jan
|
Feb
|
Mar
|
Apr
(39) |
May
(165) |
Jun
(164) |
Jul
(127) |
Aug
(81) |
Sep
(146) |
Oct
(375) |
Nov
(241) |
Dec
(77) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2007 |
Jan
(42) |
Feb
(38) |
Mar
(30) |
Apr
(6) |
May
(17) |
Jun
|
Jul
(15) |
Aug
(59) |
Sep
(31) |
Oct
(44) |
Nov
(30) |
Dec
(12) |
| 2008 |
Jan
(9) |
Feb
(63) |
Mar
(18) |
Apr
(43) |
May
(28) |
Jun
(32) |
Jul
(61) |
Aug
(5) |
Sep
(72) |
Oct
(48) |
Nov
(6) |
Dec
|
|
From: <ha...@us...> - 2007-11-25 04:27:56
|
Revision: 1846
http://cogkit.svn.sourceforge.net/cogkit/?rev=1846&view=rev
Author: hategan
Date: 2007-11-24 20:27:55 -0800 (Sat, 24 Nov 2007)
Log Message:
-----------
and some more
Modified Paths:
--------------
trunk/current/src/cog/modules/provider-ssh/src/org/globus/cog/abstraction/impl/ssh/execution/JobSubmissionTaskHandler.java
Modified: trunk/current/src/cog/modules/provider-ssh/src/org/globus/cog/abstraction/impl/ssh/execution/JobSubmissionTaskHandler.java
===================================================================
--- trunk/current/src/cog/modules/provider-ssh/src/org/globus/cog/abstraction/impl/ssh/execution/JobSubmissionTaskHandler.java 2007-11-25 04:14:31 UTC (rev 1845)
+++ trunk/current/src/cog/modules/provider-ssh/src/org/globus/cog/abstraction/impl/ssh/execution/JobSubmissionTaskHandler.java 2007-11-25 04:27:55 UTC (rev 1846)
@@ -149,11 +149,20 @@
static {
ESCAPE['\''] = true;
+ ESCAPE['\\'] = true;
ESCAPE[' '] = true;
ESCAPE['>'] = true;
ESCAPE['<'] = true;
ESCAPE['&'] = true;
ESCAPE['|'] = true;
+ ESCAPE['('] = true;
+ ESCAPE[')'] = true;
+ ESCAPE['~'] = true;
+ ESCAPE['#'] = true;
+ ESCAPE['$'] = true;
+ ESCAPE['*'] = true;
+ ESCAPE['`'] = true;
+ ESCAPE['"'] = true;
}
private void append(StringBuffer sb, String str) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ha...@us...> - 2007-11-25 04:14:33
|
Revision: 1845
http://cogkit.svn.sourceforge.net/cogkit/?rev=1845&view=rev
Author: hategan
Date: 2007-11-24 20:14:31 -0800 (Sat, 24 Nov 2007)
Log Message:
-----------
and now with proper escaping
Modified Paths:
--------------
trunk/current/src/cog/modules/provider-ssh/src/org/globus/cog/abstraction/impl/ssh/execution/JobSubmissionTaskHandler.java
Modified: trunk/current/src/cog/modules/provider-ssh/src/org/globus/cog/abstraction/impl/ssh/execution/JobSubmissionTaskHandler.java
===================================================================
--- trunk/current/src/cog/modules/provider-ssh/src/org/globus/cog/abstraction/impl/ssh/execution/JobSubmissionTaskHandler.java 2007-11-23 21:29:26 UTC (rev 1844)
+++ trunk/current/src/cog/modules/provider-ssh/src/org/globus/cog/abstraction/impl/ssh/execution/JobSubmissionTaskHandler.java 2007-11-25 04:14:31 UTC (rev 1845)
@@ -6,6 +6,8 @@
package org.globus.cog.abstraction.impl.ssh.execution;
+import java.util.Iterator;
+
import org.apache.log4j.Logger;
import org.globus.cog.abstraction.impl.common.StatusImpl;
import org.globus.cog.abstraction.impl.common.task.IllegalSpecException;
@@ -107,26 +109,33 @@
StringBuffer cmd = new StringBuffer("/bin/sh -c '");
append(cmd, spec.getExecutable());
if (spec.getArgumentsAsString() != null) {
- append(cmd, " ");
- append(cmd, spec.getArgumentsAsString());
+ cmd.append(' ');
+ Iterator i = spec.getArgumentsAsList().iterator();
+ while (i.hasNext()) {
+ String arg = (String) i.next();
+ append(cmd, arg);
+ if (i.hasNext()) {
+ cmd.append(' ');
+ }
+ }
}
if (FileLocation.LOCAL.overlaps(spec.getStdInputLocation())) {
throw new IllegalSpecException(
"The SSH provider does not support local input");
}
if (notEmpty(spec.getStdInput())) {
- append(cmd, " <");
+ cmd.append(" <");
append(cmd, spec.getStdInput());
}
if (FileLocation.REMOTE.overlaps(spec.getStdOutputLocation())
&& notEmpty(spec.getStdOutput())) {
cmd.append(" 1>");
- cmd.append(spec.getStdOutput());
+ append(cmd, spec.getStdOutput());
}
if (FileLocation.REMOTE.overlaps(spec.getStdErrorLocation())
&& notEmpty(spec.getStdError())) {
cmd.append(" 2>");
- cmd.append(spec.getStdError());
+ append(cmd, spec.getStdError());
}
cmd.append('\'');
return cmd.toString();
@@ -135,18 +144,31 @@
private boolean notEmpty(String str) {
return str != null && !str.equals("");
}
+
+ private static boolean[] ESCAPE = new boolean[256];
+
+ static {
+ ESCAPE['\''] = true;
+ ESCAPE[' '] = true;
+ ESCAPE['>'] = true;
+ ESCAPE['<'] = true;
+ ESCAPE['&'] = true;
+ ESCAPE['|'] = true;
+ }
private void append(StringBuffer sb, String str) {
for (int i = 0; i < str.length(); i++) {
char c = str.charAt(i);
- if (c == '\'') {
- sb.append("\\'");
+ if (c < 256 && c > 0 && ESCAPE[c]) {
+ sb.append('\\');
}
- else {
- sb.append(c);
- }
+ sb.append(c);
}
}
+
+ private void space(StringBuffer sb) {
+ sb.append(' ');
+ }
private void cleanup() {
SSHChannelManager.getDefault().releaseChannel(s);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ha...@us...> - 2007-11-23 21:29:35
|
Revision: 1844
http://cogkit.svn.sourceforge.net/cogkit/?rev=1844&view=rev
Author: hategan
Date: 2007-11-23 13:29:26 -0800 (Fri, 23 Nov 2007)
Log Message:
-----------
updated package names due to refactoring in SSH provider
Modified Paths:
--------------
trunk/current/src/cog/modules/karajan/resources/task.xml
Modified: trunk/current/src/cog/modules/karajan/resources/task.xml
===================================================================
--- trunk/current/src/cog/modules/karajan/resources/task.xml 2007-11-23 21:28:54 UTC (rev 1843)
+++ trunk/current/src/cog/modules/karajan/resources/task.xml 2007-11-23 21:29:26 UTC (rev 1844)
@@ -44,7 +44,7 @@
<export name="InteractiveSSHSecurityContext" restricted="true">
<element arguments="" optargs="username, privatekey, nogui">
<set name="sc">
- <java:new classname="org.globus.cog.abstraction.impl.execution.ssh.InteractiveSSHSecurityContextImpl"/>
+ <java:new classname="org.globus.cog.abstraction.impl.ssh.InteractiveSSHSecurityContextImpl"/>
</set>
<if>
<isDefined name="username"/>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ha...@us...> - 2007-11-23 21:28:55
|
Revision: 1843
http://cogkit.svn.sourceforge.net/cogkit/?rev=1843&view=rev
Author: hategan
Date: 2007-11-23 13:28:54 -0800 (Fri, 23 Nov 2007)
Log Message:
-----------
changes
Modified Paths:
--------------
trunk/current/src/cog/modules/provider-ssh/CHANGES.txt
Modified: trunk/current/src/cog/modules/provider-ssh/CHANGES.txt
===================================================================
--- trunk/current/src/cog/modules/provider-ssh/CHANGES.txt 2007-11-23 21:25:34 UTC (rev 1842)
+++ trunk/current/src/cog/modules/provider-ssh/CHANGES.txt 2007-11-23 21:28:54 UTC (rev 1843)
@@ -1,3 +1,15 @@
+(11/23/2007)
+
+*** Added connection caching and use of SSH channels, and their management
+ (tailored for OpenSSH servers: 10 max concurrent unauthenticated
+ connections, and 10 max channels per connection)
+
+*** Added a file resource for SSH (uses the SFTP subsystem)
+
+*** Rewrote the execution provider to:
+ - always start /bin/sh instead of the user shell
+ - use the channel management scheme above
+
(08/20/2007)
*** Redirection updates
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ha...@us...> - 2007-11-23 21:25:37
|
Revision: 1842
http://cogkit.svn.sourceforge.net/cogkit/?rev=1842&view=rev
Author: hategan
Date: 2007-11-23 13:25:34 -0800 (Fri, 23 Nov 2007)
Log Message:
-----------
updated provider version
Modified Paths:
--------------
trunk/current/src/cog/modules/provider-ssh/project.properties
Modified: trunk/current/src/cog/modules/provider-ssh/project.properties
===================================================================
--- trunk/current/src/cog/modules/provider-ssh/project.properties 2007-11-23 21:25:09 UTC (rev 1841)
+++ trunk/current/src/cog/modules/provider-ssh/project.properties 2007-11-23 21:25:34 UTC (rev 1842)
@@ -1,6 +1,6 @@
module.name = provider-ssh
long.name = SSH provider for abstractions
-version = 2.2
+version = 2.3
project = Java CoG Kit
lib.deps = j2ssh-common*.jar, j2ssh-core*.jar
debug = true
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ha...@us...> - 2007-11-23 21:25:14
|
Revision: 1841
http://cogkit.svn.sourceforge.net/cogkit/?rev=1841&view=rev
Author: hategan
Date: 2007-11-23 13:25:09 -0800 (Fri, 23 Nov 2007)
Log Message:
-----------
updated provider properties
Modified Paths:
--------------
trunk/current/src/cog/modules/provider-ssh/resources/cog-provider.properties
Modified: trunk/current/src/cog/modules/provider-ssh/resources/cog-provider.properties
===================================================================
--- trunk/current/src/cog/modules/provider-ssh/resources/cog-provider.properties 2007-11-23 21:24:48 UTC (rev 1840)
+++ trunk/current/src/cog/modules/provider-ssh/resources/cog-provider.properties 2007-11-23 21:25:09 UTC (rev 1841)
@@ -1,4 +1,6 @@
provider=ssh
-executionTaskHandler=org.globus.cog.abstraction.impl.execution.ssh.TaskHandlerImpl
-fileTransferTaskHandler=org.globus.cog.abstraction.impl.execution.ssh.TaskHandlerImpl
-securityContext=org.globus.cog.abstraction.impl.execution.ssh.SSHSecurityContextImpl
+executionTaskHandler=org.globus.cog.abstraction.impl.ssh.execution.TaskHandlerImpl
+fileTransferTaskHandler=org.globus.cog.abstraction.impl.ssh.execution.TaskHandlerImpl
+securityContext=org.globus.cog.abstraction.impl.ssh.SSHSecurityContextImpl
+fileResource=org.globus.cog.abstraction.impl.ssh.file.FileResourceImpl
+fileOperationTaskHandler=org.globus.cog.abstraction.impl.ssh.file.TaskHandlerImpl
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ha...@us...> - 2007-11-23 21:24:50
|
Revision: 1840
http://cogkit.svn.sourceforge.net/cogkit/?rev=1840&view=rev
Author: hategan
Date: 2007-11-23 13:24:48 -0800 (Fri, 23 Nov 2007)
Log Message:
-----------
new ssh stuff
Added Paths:
-----------
trunk/current/src/cog/modules/provider-ssh/src/org/globus/cog/abstraction/impl/ssh/
trunk/current/src/cog/modules/provider-ssh/src/org/globus/cog/abstraction/impl/ssh/ConnectionID.java
trunk/current/src/cog/modules/provider-ssh/src/org/globus/cog/abstraction/impl/ssh/CredentialsDialog.java
trunk/current/src/cog/modules/provider-ssh/src/org/globus/cog/abstraction/impl/ssh/InteractiveSSHSecurityContextImpl.java
trunk/current/src/cog/modules/provider-ssh/src/org/globus/cog/abstraction/impl/ssh/SSHChannel.java
trunk/current/src/cog/modules/provider-ssh/src/org/globus/cog/abstraction/impl/ssh/SSHChannelManager.java
trunk/current/src/cog/modules/provider-ssh/src/org/globus/cog/abstraction/impl/ssh/SSHConnectionBundle.java
trunk/current/src/cog/modules/provider-ssh/src/org/globus/cog/abstraction/impl/ssh/SSHRunner.java
trunk/current/src/cog/modules/provider-ssh/src/org/globus/cog/abstraction/impl/ssh/SSHSecurityContextImpl.java
trunk/current/src/cog/modules/provider-ssh/src/org/globus/cog/abstraction/impl/ssh/SSHTask.java
trunk/current/src/cog/modules/provider-ssh/src/org/globus/cog/abstraction/impl/ssh/SSHTaskStatusListener.java
trunk/current/src/cog/modules/provider-ssh/src/org/globus/cog/abstraction/impl/ssh/Ssh.java
trunk/current/src/cog/modules/provider-ssh/src/org/globus/cog/abstraction/impl/ssh/execution/
trunk/current/src/cog/modules/provider-ssh/src/org/globus/cog/abstraction/impl/ssh/execution/DelegatedTaskHandlerFactory.java
trunk/current/src/cog/modules/provider-ssh/src/org/globus/cog/abstraction/impl/ssh/execution/Exec.java
trunk/current/src/cog/modules/provider-ssh/src/org/globus/cog/abstraction/impl/ssh/execution/FileTransferTaskHandler.java
trunk/current/src/cog/modules/provider-ssh/src/org/globus/cog/abstraction/impl/ssh/execution/JobSubmissionTaskHandler.java
trunk/current/src/cog/modules/provider-ssh/src/org/globus/cog/abstraction/impl/ssh/execution/OutputListener.java
trunk/current/src/cog/modules/provider-ssh/src/org/globus/cog/abstraction/impl/ssh/execution/Sftp.java
trunk/current/src/cog/modules/provider-ssh/src/org/globus/cog/abstraction/impl/ssh/execution/TaskHandlerImpl.java
trunk/current/src/cog/modules/provider-ssh/src/org/globus/cog/abstraction/impl/ssh/file/
trunk/current/src/cog/modules/provider-ssh/src/org/globus/cog/abstraction/impl/ssh/file/FileResourceImpl.java
trunk/current/src/cog/modules/provider-ssh/src/org/globus/cog/abstraction/impl/ssh/file/TaskHandlerImpl.java
Removed Paths:
-------------
trunk/current/src/cog/modules/provider-ssh/src/org/globus/cog/abstraction/impl/execution/
Added: trunk/current/src/cog/modules/provider-ssh/src/org/globus/cog/abstraction/impl/ssh/ConnectionID.java
===================================================================
--- trunk/current/src/cog/modules/provider-ssh/src/org/globus/cog/abstraction/impl/ssh/ConnectionID.java (rev 0)
+++ trunk/current/src/cog/modules/provider-ssh/src/org/globus/cog/abstraction/impl/ssh/ConnectionID.java 2007-11-23 21:24:48 UTC (rev 1840)
@@ -0,0 +1,51 @@
+//----------------------------------------------------------------------
+//This code is developed as part of the Java CoG Kit project
+//The terms of the license can be found at http://www.cogkit.org/license
+//This message may not be removed or altered.
+//----------------------------------------------------------------------
+
+/*
+ * Created on Nov 20, 2007
+ */
+package org.globus.cog.abstraction.impl.ssh;
+
+public class ConnectionID {
+ public String host;
+ public int port;
+ public Object credentials;
+
+ public ConnectionID(String host, int port, Object credentials) {
+ this.host = host;
+ this.port = port;
+ this.credentials = credentials;
+ }
+
+ public boolean equals(Object obj) {
+ if (obj instanceof ConnectionID) {
+ ConnectionID other = (ConnectionID) obj;
+ return eq(host, other.host) && port == other.port
+ && eq(credentials, other.credentials);
+ }
+ else {
+ return false;
+ }
+ }
+
+ private boolean eq(Object o1, Object o2) {
+ if (o1 == null) {
+ return o2 == null;
+ }
+ else {
+ return o1.equals(o2);
+ }
+ }
+
+ public int hashCode() {
+ return (host == null ? 0 : host.hashCode()) + port
+ + (credentials == null ? 0 : credentials.hashCode());
+ }
+
+ public String toString() {
+ return credentials + "@" + host + ":" + port;
+ }
+}
\ No newline at end of file
Added: trunk/current/src/cog/modules/provider-ssh/src/org/globus/cog/abstraction/impl/ssh/CredentialsDialog.java
===================================================================
--- trunk/current/src/cog/modules/provider-ssh/src/org/globus/cog/abstraction/impl/ssh/CredentialsDialog.java (rev 0)
+++ trunk/current/src/cog/modules/provider-ssh/src/org/globus/cog/abstraction/impl/ssh/CredentialsDialog.java 2007-11-23 21:24:48 UTC (rev 1840)
@@ -0,0 +1,347 @@
+//----------------------------------------------------------------------
+//This code is developed as part of the Java CoG Kit project
+//The terms of the license can be found at http://www.cogkit.org/license
+//This message may not be removed or altered.
+//----------------------------------------------------------------------
+
+package org.globus.cog.abstraction.impl.ssh;
+
+import java.awt.BorderLayout;
+import java.awt.Dimension;
+import java.awt.GraphicsEnvironment;
+import java.awt.GridLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.PasswordAuthentication;
+import java.util.Arrays;
+
+import javax.swing.JButton;
+import javax.swing.JDialog;
+import javax.swing.JFileChooser;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JPasswordField;
+import javax.swing.JTextField;
+
+import org.globus.cog.abstraction.impl.common.PublicKeyAuthentication;
+
+public abstract class CredentialsDialog {
+ private static final String NOTHING = "";
+ private static final String SSH_HOME = System.getProperty("user.home") + File.separator
+ + ".ssh";
+
+ protected String userName, privateKey;
+
+ public String getPrivateKey() {
+ return privateKey;
+ }
+
+ public void setPrivateKey(String privatekey) {
+ this.privateKey = privatekey;
+ }
+
+ public String getUserName() {
+ return userName;
+ }
+
+ public void setUserName(String username) {
+ this.userName = username;
+ }
+
+ public abstract Object getResult();
+
+ public static Object showCredentialsDialog() {
+ return showCredentialsDialog(null, null);
+ }
+
+ public static Object showCredentialsDialog(String userName, String privateKey) {
+ return showCredentialsDialog(userName, privateKey, false);
+ }
+
+ public static Object showCredentialsDialog(String userName, String privateKey,
+ boolean forceTextMode) {
+ CredentialsDialog cd;
+ try {
+ if (GraphicsEnvironment.isHeadless() || forceTextMode) {
+ cd = new ConsoleCredentialsDialog();
+ }
+ else {
+ cd = new SwingCredentialsDialog();
+ }
+ }
+ catch (Exception e) {
+ cd = new ConsoleCredentialsDialog();
+ }
+ if (userName != null) {
+ cd.setUserName(userName);
+ }
+ if (privateKey != null) {
+ cd.setPrivateKey(privateKey);
+ }
+ return cd.getResult();
+ }
+
+ public static class SwingCredentialsDialog extends CredentialsDialog {
+ private JOptionPane optionPane = new JOptionPane();
+ private JDialog dialog;
+
+ private JLabel passwordLabel;
+ private JTextField usernameField = new JTextField();
+ private JPasswordField passwordField = new JPasswordField();
+ private JTextField privateKeyField = new JTextField();
+
+ private JButton choosePathButton = new JButton("Browse");
+
+ public SwingCredentialsDialog() {
+ // init sizes
+ usernameField.setPreferredSize(new Dimension(125, 20));
+ passwordField.setPreferredSize(new Dimension(125, 20));
+ privateKeyField.setPreferredSize(new Dimension(150, 20));
+
+ // the main panel
+ JPanel main = new JPanel(new BorderLayout());
+
+ // Labels
+ JPanel labels = new JPanel(new GridLayout(0, 1));
+ labels.add(new JLabel("Username: "));
+ labels.add(passwordLabel = new JLabel("Password: "));
+ JLabel pkLabel = new JLabel("Private Key: ");
+ pkLabel.setToolTipText("Your private key if needed, else leave blank");
+ labels.add(pkLabel);
+
+ // username and password labels/fields
+ JPanel fields = new JPanel(new GridLayout(0, 1));
+ fields.add(usernameField);
+ fields.add(passwordField);
+
+ // path to the private key field/button
+ JPanel pKeyPanel = new JPanel(new BorderLayout());
+ privateKeyField.setToolTipText("Your private key if needed, else leave blank");
+ pKeyPanel.add(privateKeyField, BorderLayout.CENTER);
+ pKeyPanel.add(choosePathButton, BorderLayout.EAST);
+
+ // add an action listener
+ choosePathButton.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent aEvent) {
+ choosePathToPrivateKey();
+ }
+ });
+
+ fields.add(pKeyPanel);
+
+ main.add(labels, BorderLayout.WEST);
+ main.add(fields, BorderLayout.CENTER);
+
+ optionPane.setMessage(main);
+ optionPane.setOptionType(JOptionPane.OK_CANCEL_OPTION);
+ dialog = optionPane.createDialog(null, "Enter Your SSH Credentials");
+ }
+
+ protected void choosePathToPrivateKey() {
+ JFileChooser fileChooser = new JFileChooser(SSH_HOME);
+ fileChooser.setFileHidingEnabled(false);
+ int returnVal = fileChooser.showOpenDialog(optionPane);
+ if (returnVal == JFileChooser.APPROVE_OPTION) {
+ setPrivateKeyFieldText(fileChooser.getSelectedFile().getAbsolutePath());
+ }
+ }
+
+ protected synchronized Object okButtonPushed() {
+ String uname = usernameField.getText();
+ char[] passwd = passwordField.getPassword();
+ String pKeyPath = privateKeyField.getText();
+
+ if (NOTHING.equals(uname) && NOTHING.equals(passwd) && NOTHING.equals(pKeyPath)) {
+ return null;
+ }
+ else if (passwd == null) { // prevent null pointers
+ return null;
+ }
+ else if (NOTHING.equals(pKeyPath)) {
+ return new PasswordAuthentication(uname, passwd);
+ }
+ else {
+ return new PublicKeyAuthentication(uname, pKeyPath, passwd);
+ }
+ }
+
+ public Object getResult() {
+ dialog.setVisible(true);
+ if (optionPane.getValue() != null
+ && ((Integer) optionPane.getValue()).equals(new Integer(JOptionPane.OK_OPTION))) {
+ return okButtonPushed();
+ }
+ else {
+ return null;
+ }
+ }
+
+ public void setPrivateKey(String privatekey) {
+ super.setPrivateKey(privatekey);
+ setPrivateKeyFieldText(privatekey);
+ }
+
+ private void setPrivateKeyFieldText(String privateKey) {
+ privateKeyField.setText(privateKey);
+ if (privateKey == null || privateKey.equals("")) {
+ passwordLabel.setText("Password: ");
+ }
+ else {
+ passwordLabel.setText("Passphrase: ");
+ }
+ }
+
+ public void setUserName(String username) {
+ super.setUserName(username);
+ usernameField.setText(username);
+ if (username != null) {
+ passwordField.requestFocus();
+ }
+ }
+
+ }
+
+ public static class ConsoleCredentialsDialog extends CredentialsDialog {
+ public String TAB = "\t";
+ public static final int MAX_MASKED_CHARS = 80;
+
+ public Object getResult() {
+ if (userName == null) {
+ System.out.print("Username: ");
+ userName = input();
+ }
+ else {
+ System.out.println("Username: " + userName);
+ }
+ if (privateKey == null) {
+ System.out.println("Empty password for public key authentication.");
+ System.out.print("Password: ");
+ char[] tmp = inputMasked();
+ if (tmp.length == 0) {
+ for (int i = 0; i < 80; i++) {
+ System.out.print('\b');
+ }
+ String defaultPK = getDefaultPrivateKey();
+ System.out.println("Private key file ["+defaultPK+"]: ");
+ privateKey = input();
+ if (privateKey == null || privateKey.equals("")) {
+ privateKey = defaultPK;
+ }
+ System.out.print("Passphrase: ");
+ return new PublicKeyAuthentication(userName, privateKey, inputMasked());
+ }
+ else {
+ return new PasswordAuthentication(userName, tmp);
+ }
+ }
+ else {
+ System.out.println("Private key: " + privateKey);
+ System.out.print("Passphrase: ");
+ return new PublicKeyAuthentication(userName, privateKey, inputMasked());
+ }
+ }
+
+ protected String getDefaultPrivateKey() {
+ File pk;
+ pk = new File(SSH_HOME, "identity");
+ if (pk.exists()) {
+ return pk.getAbsolutePath();
+ }
+ pk = new File(SSH_HOME);
+ if (pk.exists()) {
+ return pk.getAbsolutePath();
+ }
+ return "";
+ }
+
+ protected String input() {
+ BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
+ try {
+ return br.readLine();
+ }
+ catch (IOException e) {
+ return "";
+ }
+ }
+
+ protected synchronized char[] inputMasked() {
+ char[] buf = new char[MAX_MASKED_CHARS];
+ int crt = 0;
+ char c;
+ ConsoleMasker.startMasking();
+ while (crt < MAX_MASKED_CHARS) {
+ try {
+ c = (char) System.in.read();
+ if (c == '\n') {
+ break;
+ }
+ else {
+ buf[crt++] = c;
+ }
+ }
+ catch (IOException e) {
+ break;
+ }
+ }
+ ConsoleMasker.stopMasking();
+ char[] in = new char[crt];
+ System.arraycopy(buf, 0, in, 0, crt);
+ Arrays.fill(buf, '\0');
+ return in;
+ }
+ }
+
+ public static class ConsoleMasker extends Thread {
+ private static ConsoleMasker masker;
+ private volatile boolean done;
+
+ public synchronized static void startMasking() {
+ if (masker != null) {
+ throw new IllegalStateException("Another maskeing thread");
+ }
+ masker = new ConsoleMasker();
+ masker.start();
+ }
+
+ public synchronized static void stopMasking() {
+ if (masker == null) {
+ throw new IllegalStateException("No masking thread is active");
+ }
+ masker.done();
+ masker = null;
+ }
+
+ public ConsoleMasker() {
+ this.setPriority(Thread.MAX_PRIORITY);
+ this.setName("Console Masking");
+ }
+
+ public void run() {
+ System.out.print(' ');
+ char crt = ' ';
+ while (!done) {
+ System.out.print('\b');
+ System.out.print(crt++);
+ System.out.flush();
+ if (crt == 127) {
+ crt = ' ';
+ }
+ try {
+ Thread.sleep(1);
+ }
+ catch (InterruptedException e) {
+ return;
+ }
+ }
+ }
+
+ private void done() {
+ done = true;
+ }
+ }
+}
\ No newline at end of file
Added: trunk/current/src/cog/modules/provider-ssh/src/org/globus/cog/abstraction/impl/ssh/InteractiveSSHSecurityContextImpl.java
===================================================================
--- trunk/current/src/cog/modules/provider-ssh/src/org/globus/cog/abstraction/impl/ssh/InteractiveSSHSecurityContextImpl.java (rev 0)
+++ trunk/current/src/cog/modules/provider-ssh/src/org/globus/cog/abstraction/impl/ssh/InteractiveSSHSecurityContextImpl.java 2007-11-23 21:24:48 UTC (rev 1840)
@@ -0,0 +1,72 @@
+//----------------------------------------------------------------------
+//This code is developed as part of the Java CoG Kit project
+//The terms of the license can be found at http://www.cogkit.org/license
+//This message may not be removed or altered.
+//----------------------------------------------------------------------
+
+package org.globus.cog.abstraction.impl.ssh;
+
+import java.net.PasswordAuthentication;
+import java.util.Hashtable;
+
+import org.apache.log4j.Logger;
+import org.globus.cog.abstraction.interfaces.SecurityContext;
+
+public class InteractiveSSHSecurityContextImpl implements SecurityContext {
+
+ private static Logger logger = Logger.getLogger(InteractiveSSHSecurityContextImpl.class.getName());
+ private Object credentials;
+
+ private Hashtable attributes = new Hashtable();
+
+ public InteractiveSSHSecurityContextImpl() {
+ // this.credentials = new PasswordAuthentication(null, null);
+ }
+
+ public InteractiveSSHSecurityContextImpl(Object credentials) {
+ setCredentials(credentials);
+ }
+
+ public void setCredentials(Object credentials, String alias) {
+ setCredentials(credentials);
+ }
+
+ public void setCredentials(Object credentials) {
+ this.credentials = credentials;
+ }
+
+ public synchronized Object getCredentials() {
+ if (credentials == null) {
+ boolean forceText = false;
+ Object text = getAttribute("nogui");
+ if (text != null
+ && (Boolean.TRUE.equals(text) || (text instanceof String && Boolean.valueOf(
+ (String) text).booleanValue()))) {
+ forceText = true;
+ }
+ credentials = CredentialsDialog.showCredentialsDialog(
+ (String) getAttribute("username"), (String) getAttribute("privatekey"), forceText);
+ if (credentials == null) {
+ // Cancel was pressed, so we set it to mock credentials to
+ // avoid being asked again
+ credentials = new PasswordAuthentication("", new char[0]);
+ }
+ }
+ return this.credentials;
+ }
+
+ public void setAttribute(String name, Object value) {
+ this.attributes.put(name, value);
+ }
+
+ public Object getAttribute(String name) {
+ return this.attributes.get(name);
+ }
+
+ public void setAlias(String alias) {
+ }
+
+ public String getAlias() {
+ return null;
+ }
+}
Added: trunk/current/src/cog/modules/provider-ssh/src/org/globus/cog/abstraction/impl/ssh/SSHChannel.java
===================================================================
--- trunk/current/src/cog/modules/provider-ssh/src/org/globus/cog/abstraction/impl/ssh/SSHChannel.java (rev 0)
+++ trunk/current/src/cog/modules/provider-ssh/src/org/globus/cog/abstraction/impl/ssh/SSHChannel.java 2007-11-23 21:24:48 UTC (rev 1840)
@@ -0,0 +1,38 @@
+//----------------------------------------------------------------------
+//This code is developed as part of the Java CoG Kit project
+//The terms of the license can be found at http://www.cogkit.org/license
+//This message may not be removed or altered.
+//----------------------------------------------------------------------
+
+/*
+ * Created on Nov 20, 2007
+ */
+package org.globus.cog.abstraction.impl.ssh;
+
+import com.sshtools.j2ssh.session.SessionChannelClient;
+
+public class SSHChannel {
+ private Ssh connection;
+ private SessionChannelClient session;
+ private SSHConnectionBundle bundle;
+
+ public SSHChannel(SSHConnectionBundle bundle, Ssh connection, SessionChannelClient session) {
+ this.connection = connection;
+ this.session = session;
+ this.bundle = bundle;
+ }
+
+ public Ssh getSsh() {
+ return connection;
+ }
+
+ public SessionChannelClient getSession() {
+ return session;
+ }
+
+ public SSHConnectionBundle getBundle() {
+ return bundle;
+ }
+
+
+}
Added: trunk/current/src/cog/modules/provider-ssh/src/org/globus/cog/abstraction/impl/ssh/SSHChannelManager.java
===================================================================
--- trunk/current/src/cog/modules/provider-ssh/src/org/globus/cog/abstraction/impl/ssh/SSHChannelManager.java (rev 0)
+++ trunk/current/src/cog/modules/provider-ssh/src/org/globus/cog/abstraction/impl/ssh/SSHChannelManager.java 2007-11-23 21:24:48 UTC (rev 1840)
@@ -0,0 +1,204 @@
+//----------------------------------------------------------------------
+//This code is developed as part of the Java CoG Kit project
+//The terms of the license can be found at http://www.cogkit.org/license
+//This message may not be removed or altered.
+//----------------------------------------------------------------------
+
+/*
+ * Created on Nov 19, 2007
+ */
+package org.globus.cog.abstraction.impl.ssh;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.net.PasswordAuthentication;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Map.Entry;
+
+import org.apache.log4j.Logger;
+import org.globus.cog.abstraction.impl.common.PublicKeyAuthentication;
+import org.globus.cog.abstraction.impl.common.task.IllegalSpecException;
+import org.globus.cog.abstraction.impl.common.task.InvalidSecurityContextException;
+import org.globus.cog.abstraction.impl.common.task.InvalidServiceContactException;
+import org.globus.cog.abstraction.impl.common.task.TaskSubmissionException;
+
+public class SSHChannelManager {
+ public static final Logger logger = Logger
+ .getLogger(SSHChannelManager.class);
+
+ public static final long REAP_INTERVAL = 10 * 1000;
+
+ private static SSHChannelManager defaultManager;
+
+ static {
+ defaultManager = new SSHChannelManager();
+ }
+
+ public static SSHChannelManager getDefault() {
+ return defaultManager;
+ }
+
+ private Map bundles;
+ private Reaper reaper;
+
+ public SSHChannelManager() {
+ bundles = new HashMap();
+ reaper = new Reaper();
+ reaper.start();
+ }
+
+ public SSHChannel getChannel(String host, int port, Object credentials)
+ throws InvalidSecurityContextException, IllegalSpecException,
+ InvalidServiceContactException, TaskSubmissionException {
+ if (port == -1) {
+ port = 22;
+ }
+ ConnectionID i = new ConnectionID(host, port, getCredentials(credentials, host));
+ SSHConnectionBundle bundle = null;
+ synchronized (bundles) {
+ bundle = (SSHConnectionBundle) bundles.get(i);
+ if (bundle == null) {
+ bundle = new SSHConnectionBundle(i);
+ bundles.put(i, bundle);
+ }
+ }
+ return bundle.allocateChannel();
+ }
+
+ private static final char[] NO_PASSPHRASE = new char[0];
+
+ public static Object getCredentials(Object credentials, String host)
+ throws InvalidSecurityContextException {
+ if (credentials == null) {
+ credentials = getDefaultCredentials(host);
+ }
+ if (credentials instanceof PasswordAuthentication) {
+ return credentials;
+ }
+ else if (credentials instanceof PublicKeyAuthentication) {
+ return credentials;
+ }
+ else if (credentials == null) {
+ throw new InvalidSecurityContextException(
+ "No credentials specified and no entry found in "
+ + getAuthFilePath() + " for " + host);
+ }
+ else {
+ throw new InvalidSecurityContextException(
+ "Unsupported credentials: " + credentials);
+ }
+ }
+
+ public void releaseChannel(SSHChannel s) {
+ s.getBundle().releaseChannel(s);
+ }
+
+ private static Map credentials;
+ private static long lastLoad;
+ public static final String CREDENTIALS_FILE = "auth.defaults";
+
+ static {
+ credentials = new HashMap();
+ }
+
+ private static String getAuthFilePath() {
+ return System.getProperty("user.home") + File.separator + ".ssh"
+ + File.separator + CREDENTIALS_FILE;
+ }
+
+ public static Object getDefaultCredentials(String host) {
+ File f = new File(getAuthFilePath());
+ if (f.exists()) {
+ if (lastLoad < f.lastModified()) {
+ try {
+ loadDefaultCredentials(f);
+ }
+ catch (IOException e) {
+ logger.warn("Failed to load default credentials file", e);
+ }
+ }
+ synchronized (credentials) {
+ return credentials.get(host);
+ }
+ }
+ else {
+ return null;
+ }
+ }
+
+ public static void loadDefaultCredentials(File f) throws IOException {
+ synchronized (credentials) {
+ credentials.clear();
+ Properties p = new Properties();
+ p.load(new FileInputStream(f));
+ Iterator i = p.entrySet().iterator();
+ while (i.hasNext()) {
+ Map.Entry e = (Map.Entry) i.next();
+ String key = (String) e.getKey();
+ String val = (String) e.getValue();
+ if (key.endsWith(".type")) {
+ String host = key.substring(0, key.length() - 5);
+ String username = p.getProperty(host + ".username");
+ if (username == null) {
+ username = System.getProperty("user.name");
+ }
+ Object auth = null;
+ if ("password".equals(val)) {
+ String password = p.getProperty(host + ".password");
+ auth = new PasswordAuthentication(username, password
+ .toCharArray());
+ }
+ else if ("key".equals(val)) {
+ String pkey = p.getProperty(host + ".key");
+ String passphrase = p.getProperty(host + ".passphrase");
+ auth = new PublicKeyAuthentication(username, pkey,
+ passphrase.toCharArray());
+ }
+ else {
+ logger.warn("Unknown authentication type for \"" + host
+ + "\": " + val);
+ }
+ credentials.put(host, auth);
+ }
+ }
+ lastLoad = System.currentTimeMillis();
+ }
+ }
+
+ private class Reaper extends Thread {
+ public Reaper() {
+ super("SSH Channel Reaper");
+ setDaemon(true);
+ }
+
+ public void run() {
+ try {
+ List shutdown = new ArrayList();
+ while (true) {
+ shutdown.clear();
+ Thread.sleep(REAP_INTERVAL);
+ synchronized (bundles) {
+ Iterator i = bundles.entrySet().iterator();
+ while (i.hasNext()) {
+ Map.Entry e = (Entry) i.next();
+ ConnectionID ix = (ConnectionID) e.getKey();
+ SSHConnectionBundle bundle = (SSHConnectionBundle) e.getValue();
+ if (!bundle.shutdownIdleConnections()) {
+ i.remove();
+ }
+ }
+ }
+ }
+ }
+ catch (InterruptedException e) {
+
+ }
+ }
+ }
+}
Added: trunk/current/src/cog/modules/provider-ssh/src/org/globus/cog/abstraction/impl/ssh/SSHConnectionBundle.java
===================================================================
--- trunk/current/src/cog/modules/provider-ssh/src/org/globus/cog/abstraction/impl/ssh/SSHConnectionBundle.java (rev 0)
+++ trunk/current/src/cog/modules/provider-ssh/src/org/globus/cog/abstraction/impl/ssh/SSHConnectionBundle.java 2007-11-23 21:24:48 UTC (rev 1840)
@@ -0,0 +1,254 @@
+//----------------------------------------------------------------------
+//This code is developed as part of the Java CoG Kit project
+//The terms of the license can be found at http://www.cogkit.org/license
+//This message may not be removed or altered.
+//----------------------------------------------------------------------
+
+/*
+ * Created on Nov 20, 2007
+ */
+package org.globus.cog.abstraction.impl.ssh;
+
+import java.io.IOException;
+import java.net.PasswordAuthentication;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+import org.globus.cog.abstraction.impl.common.PublicKeyAuthentication;
+import org.globus.cog.abstraction.impl.common.task.InvalidSecurityContextException;
+import org.globus.cog.abstraction.impl.common.task.InvalidServiceContactException;
+import org.globus.cog.abstraction.impl.common.task.TaskSubmissionException;
+
+public class SSHConnectionBundle {
+ public static final Logger logger = Logger
+ .getLogger(SSHConnectionBundle.class);
+
+ public static final long MAX_IDLE_TIME = 60 * 1000;
+ public static final int MAX_SESSIONS_PER_CONNECTION = 10;
+ public static final int MAX_CONCURRENT_CONNECTIONS = 10;
+
+ private List connections;
+ private ConnectionID id;
+ private Object credentials;
+ private int connecting;
+
+ public SSHConnectionBundle(ConnectionID id) {
+ this.id = id;
+ connections = new ArrayList();
+ if (logger.isDebugEnabled()) {
+ logger.debug("New SSH connection bundle: " + id);
+ }
+ }
+
+ public ConnectionID getId() {
+ return id;
+ }
+
+ public Object getCredentials() {
+ return credentials;
+ }
+
+ public void setCredentials(Object credentials) {
+ this.credentials = credentials;
+ }
+
+ public SSHChannel allocateChannel() throws InvalidSecurityContextException,
+ InvalidServiceContactException, TaskSubmissionException {
+ Connection connection = null;
+ synchronized (connections) {
+ Iterator i = connections.iterator();
+ while (i.hasNext()) {
+ Connection c = (Connection) i.next();
+ if (c.sessionCount < MAX_SESSIONS_PER_CONNECTION) {
+ connection = c;
+ break;
+ }
+ }
+ if (connection == null) {
+ connection = newConnection();
+ connections.add(connection);
+ }
+ connection.sessionCount++;
+ }
+ try {
+ connection.ensureConnected();
+ }
+ catch (Exception e) {
+ badSsh(connection.ssh);
+ rethrow(e);
+ }
+ try {
+ if (logger.isDebugEnabled()) {
+ logger.debug("Creating new SSH session to " + id);
+ }
+ return new SSHChannel(this, connection.ssh, connection.ssh
+ .openSessionChannel());
+ }
+ catch (IOException e) {
+ throw new TaskSubmissionException("Failed to create SSH session", e);
+ }
+ }
+
+ private Connection newConnection() {
+ if (logger.isDebugEnabled()) {
+ logger.debug("Creating new SSH connection to " + id);
+ }
+ Ssh ssh = new Ssh();
+ ssh.setHost(id.host);
+ ssh.setPort(id.port);
+ if (id.credentials instanceof PasswordAuthentication) {
+ PasswordAuthentication auth = (PasswordAuthentication) id.credentials;
+ ssh.setUsername(auth.getUserName());
+ ssh.setPassword(String.valueOf(auth.getPassword()));
+ }
+ else if (id.credentials instanceof PublicKeyAuthentication) {
+ PublicKeyAuthentication auth = (PublicKeyAuthentication) id.credentials;
+ ssh.setUsername(auth.getUsername());
+ ssh.setKeyfile(auth.getPrivateKeyFile().getAbsolutePath());
+ if (auth.getPassPhrase() != null) {
+ ssh.setPassphrase(String.valueOf(auth.getPassPhrase()));
+ }
+ }
+ Connection c = new Connection(ssh);
+ return c;
+ }
+
+ public void releaseChannel(SSHChannel s) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("Releasing ssh channel for " + id);
+ }
+ try {
+ s.getSession().close();
+ }
+ catch (IOException e) {
+ badSsh(s.getSsh());
+ }
+ synchronized (connections) {
+ Ssh ssh = s.getSsh();
+ Iterator i = connections.iterator();
+ while (i.hasNext()) {
+ Connection c = (Connection) i.next();
+ if (c.ssh == ssh) {
+ c.sessionCount--;
+ if (c.sessionCount == 0) {
+ c.idleTime = System.currentTimeMillis();
+ }
+ break;
+ }
+ }
+ }
+ }
+
+ private void badSsh(Ssh ssh) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("Bad connection for " + id + ". Removing.");
+ }
+ synchronized (connections) {
+ Iterator i = connections.iterator();
+ while (i.hasNext()) {
+ Connection c = (Connection) i.next();
+ if (c.ssh == ssh) {
+ i.remove();
+ break;
+ }
+ }
+ }
+ }
+
+ public boolean shutdownIdleConnections() {
+ long crt = System.currentTimeMillis();
+ boolean anyActive = false;
+ synchronized (connections) {
+ Iterator i = connections.iterator();
+ while (i.hasNext()) {
+ Connection c = (Connection) i.next();
+ if (c.sessionCount == 0 && crt - c.idleTime > MAX_IDLE_TIME) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("Shutting down idle connection for " + id);
+ }
+ c.ssh.disconnect();
+ }
+ else {
+ anyActive = true;
+ }
+ }
+ }
+ return anyActive;
+ }
+
+ private void rethrow(Exception e) throws InvalidSecurityContextException,
+ InvalidServiceContactException, TaskSubmissionException {
+ if (e instanceof InvalidSecurityContextException) {
+ throw (InvalidSecurityContextException) e;
+ }
+ if (e instanceof InvalidServiceContactException) {
+ throw (InvalidServiceContactException) e;
+ }
+ if (e instanceof TaskSubmissionException) {
+ throw (TaskSubmissionException) e;
+ }
+ if (e != null) {
+ throw new TaskSubmissionException(e);
+ }
+ }
+
+ private class Connection {
+ private Ssh ssh;
+ public int sessionCount;
+ public long idleTime;
+ private boolean fconnecting, fconnected;
+ private Exception connectionException;
+
+ public Connection(Ssh connection) {
+ this.ssh = connection;
+ }
+
+ public void ensureConnected() throws InvalidSecurityContextException,
+ InvalidServiceContactException, TaskSubmissionException {
+ try {
+ synchronized (this) {
+ while (fconnecting) {
+ wait();
+ }
+ if (fconnected) {
+ rethrow(connectionException);
+ return;
+ }
+ else {
+ fconnecting = true;
+ }
+ }
+ synchronized (id) {
+ connecting++;
+ while (connecting > MAX_CONCURRENT_CONNECTIONS) {
+ id.wait();
+ }
+ }
+ try {
+ ssh.connect();
+ }
+ catch (Exception e) {
+ synchronized (id) {
+ connectionException = e;
+ }
+ }
+ synchronized (id) {
+ connecting--;
+ id.notify();
+ }
+ synchronized (this) {
+ fconnecting = false;
+ fconnected = true;
+ notifyAll();
+ }
+ rethrow(connectionException);
+ }
+ catch (InterruptedException e) {
+ throw new TaskSubmissionException(
+ "Thread got interrupted while connecting", e);
+ }
+ }
+ }
+}
Added: trunk/current/src/cog/modules/provider-ssh/src/org/globus/cog/abstraction/impl/ssh/SSHRunner.java
===================================================================
--- trunk/current/src/cog/modules/provider-ssh/src/org/globus/cog/abstraction/impl/ssh/SSHRunner.java (rev 0)
+++ trunk/current/src/cog/modules/provider-ssh/src/org/globus/cog/abstraction/impl/ssh/SSHRunner.java 2007-11-23 21:24:48 UTC (rev 1840)
@@ -0,0 +1,87 @@
+// ----------------------------------------------------------------------
+// This code is developed as part of the Java CoG Kit project
+// The terms of the license can be found at http://www.cogkit.org/license
+// This message may not be removed or altered.
+// ----------------------------------------------------------------------
+
+package org.globus.cog.abstraction.impl.ssh;
+
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.globus.cog.abstraction.impl.common.execution.JobException;
+import org.globus.cog.abstraction.impl.common.task.IllegalSpecException;
+import org.globus.cog.abstraction.impl.common.task.InvalidSecurityContextException;
+import org.globus.cog.abstraction.impl.common.task.InvalidServiceContactException;
+import org.globus.cog.abstraction.impl.common.task.TaskSubmissionException;
+
+public class SSHRunner implements Runnable {
+ private SSHTask crt;
+ private SSHChannel s;
+ private List listeners;
+ private boolean shutdownFlag;
+ private static int id;
+
+ public SSHRunner(SSHChannel s, SSHTask task) {
+ this.crt = task;
+ this.s = s;
+ }
+
+ public Thread wrapInThread() {
+ Thread t = new Thread(this);
+ synchronized (SSHRunner.class) {
+ t.setName("SSH Thread " + (id++));
+ }
+ t.setDaemon(true);
+ return t;
+ }
+
+ public void run() {
+ try {
+ runTask(crt);
+ notifyListeners(SSHTaskStatusListener.COMPLETED, null);
+ }
+ catch (Exception e) {
+ notifyListeners(SSHTaskStatusListener.FAILED, e);
+ }
+ }
+
+ public void runTask(SSHTask t) throws IllegalSpecException,
+ InvalidSecurityContextException, InvalidServiceContactException,
+ TaskSubmissionException, JobException {
+ t.execute(s.getSession());
+ }
+
+ public void startRun(SSHTask run) {
+ this.crt = run;
+ Thread t = wrapInThread();
+ t.start();
+ }
+
+ public void addListener(SSHTaskStatusListener l) {
+ if (listeners == null) {
+ listeners = new LinkedList();
+ }
+ if (!listeners.contains(l)) {
+ listeners.add(l);
+ }
+ }
+
+ public void removeListener(SSHTaskStatusListener l) {
+ if (listeners != null) {
+ listeners.remove(l);
+ }
+ }
+
+ public void clearListeners() {
+ listeners.clear();
+ }
+
+ public void notifyListeners(int event, Exception e) {
+ Iterator i = listeners.iterator();
+ while (i.hasNext()) {
+ ((SSHTaskStatusListener) i.next()).SSHTaskStatusChanged(event, e);
+ }
+ }
+}
Added: trunk/current/src/cog/modules/provider-ssh/src/org/globus/cog/abstraction/impl/ssh/SSHSecurityContextImpl.java
===================================================================
--- trunk/current/src/cog/modules/provider-ssh/src/org/globus/cog/abstraction/impl/ssh/SSHSecurityContextImpl.java (rev 0)
+++ trunk/current/src/cog/modules/provider-ssh/src/org/globus/cog/abstraction/impl/ssh/SSHSecurityContextImpl.java 2007-11-23 21:24:48 UTC (rev 1840)
@@ -0,0 +1,59 @@
+//----------------------------------------------------------------------
+//This code is developed as part of the Java CoG Kit project
+//The terms of the license can be found at http://www.cogkit.org/license
+//This message may not be removed or altered.
+//----------------------------------------------------------------------
+
+package org.globus.cog.abstraction.impl.ssh;
+
+import java.util.Hashtable;
+
+import org.apache.log4j.Logger;
+import org.globus.cog.abstraction.impl.common.task.InvalidSecurityContextException;
+import org.globus.cog.abstraction.interfaces.SecurityContext;
+
+public class SSHSecurityContextImpl implements SecurityContext {
+
+ private static Logger logger = Logger
+ .getLogger(SSHSecurityContextImpl.class.getName());
+ private Object credentials;
+
+ private Hashtable attributes = new Hashtable();
+
+ public SSHSecurityContextImpl() {
+ // this.credentials = new PasswordAuthentication(null, null);
+ }
+
+ public SSHSecurityContextImpl(Object credentials) {
+ setCredentials(credentials);
+ }
+
+ public void setCredentials(Object credentials, String alias) {
+ setCredentials(credentials);
+ }
+
+ public void setCredentials(Object credentials) {
+ this.credentials = credentials;
+ }
+
+ public Object getCredentials() throws InvalidSecurityContextException {
+ return this.credentials;
+ }
+
+ public void setAttribute(String name, Object value) {
+ this.attributes.put(name, value);
+ }
+
+ public Object getAttribute(String name) {
+
+ return this.attributes.get(name);
+ }
+
+ public void setAlias(String alias) {
+ }
+
+ public String getAlias() {
+
+ return null;
+ }
+}
Added: trunk/current/src/cog/modules/provider-ssh/src/org/globus/cog/abstraction/impl/ssh/SSHTask.java
===================================================================
--- trunk/current/src/cog/modules/provider-ssh/src/org/globus/cog/abstraction/impl/ssh/SSHTask.java (rev 0)
+++ trunk/current/src/cog/modules/provider-ssh/src/org/globus/cog/abstraction/impl/ssh/SSHTask.java 2007-11-23 21:24:48 UTC (rev 1840)
@@ -0,0 +1,25 @@
+//----------------------------------------------------------------------
+//This code is developed as part of the Java CoG Kit project
+//The terms of the license can be found at http://www.cogkit.org/license
+//This message may not be removed or altered.
+//----------------------------------------------------------------------
+
+/*
+ * Created on Nov 19, 2007
+ */
+package org.globus.cog.abstraction.impl.ssh;
+
+import org.globus.cog.abstraction.impl.common.execution.JobException;
+import org.globus.cog.abstraction.impl.common.task.IllegalSpecException;
+import org.globus.cog.abstraction.impl.common.task.InvalidSecurityContextException;
+import org.globus.cog.abstraction.impl.common.task.InvalidServiceContactException;
+import org.globus.cog.abstraction.impl.common.task.TaskSubmissionException;
+
+import com.sshtools.j2ssh.session.SessionChannelClient;
+
+public interface SSHTask {
+ public void execute(SessionChannelClient session)
+ throws IllegalSpecException, InvalidSecurityContextException,
+ InvalidServiceContactException, TaskSubmissionException,
+ JobException;
+}
Added: trunk/current/src/cog/modules/provider-ssh/src/org/globus/cog/abstraction/impl/ssh/SSHTaskStatusListener.java
===================================================================
--- trunk/current/src/cog/modules/provider-ssh/src/org/globus/cog/abstraction/impl/ssh/SSHTaskStatusListener.java (rev 0)
+++ trunk/current/src/cog/modules/provider-ssh/src/org/globus/cog/abstraction/impl/ssh/SSHTaskStatusListener.java 2007-11-23 21:24:48 UTC (rev 1840)
@@ -0,0 +1,13 @@
+// ----------------------------------------------------------------------
+// This code is developed as part of the Java CoG Kit project
+// The terms of the license can be found at http://www.cogkit.org/license
+// This message may not be removed or altered.
+// ----------------------------------------------------------------------
+
+package org.globus.cog.abstraction.impl.ssh;
+
+public interface SSHTaskStatusListener {
+ public static final int FAILED = 1;
+ public static final int COMPLETED = 0;
+ public void SSHTaskStatusChanged(int status, Exception e);
+}
Added: trunk/current/src/cog/modules/provider-ssh/src/org/globus/cog/abstraction/impl/ssh/Ssh.java
===================================================================
--- trunk/current/src/cog/modules/provider-ssh/src/org/globus/cog/abstraction/impl/ssh/Ssh.java (rev 0)
+++ trunk/current/src/cog/modules/provider-ssh/src/org/globus/cog/abstraction/impl/ssh/Ssh.java 2007-11-23 21:24:48 UTC (rev 1840)
@@ -0,0 +1,373 @@
+// ----------------------------------------------------------------------
+// This code is developed as part of the Java CoG Kit project
+// The terms of the license can be found at http://www.cogkit.org/license
+// This message may not be removed or altered.
+// ----------------------------------------------------------------------
+
+/*
+ * Sshtools - Java SSH2 API
+ *
+ * Copyright (C) 2002 Lee David Painter.
+ *
+ * Written by: 2002 Lee David Painter <le...@ss...>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * as published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.globus.cog.abstraction.impl.ssh;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+
+import org.apache.log4j.Logger;
+import org.globus.cog.abstraction.impl.common.task.InvalidSecurityContextException;
+import org.globus.cog.abstraction.impl.common.task.InvalidServiceContactException;
+import org.globus.cog.abstraction.impl.common.task.TaskSubmissionException;
+
+import com.sshtools.common.hosts.AbstractHostKeyVerification;
+import com.sshtools.j2ssh.SshClient;
+import com.sshtools.j2ssh.authentication.AuthenticationProtocolState;
+import com.sshtools.j2ssh.authentication.PasswordAuthenticationClient;
+import com.sshtools.j2ssh.authentication.PublicKeyAuthenticationClient;
+import com.sshtools.j2ssh.configuration.ConfigurationLoader;
+import com.sshtools.j2ssh.configuration.SshConnectionProperties;
+import com.sshtools.j2ssh.session.SessionChannelClient;
+import com.sshtools.j2ssh.transport.InvalidHostFileException;
+import com.sshtools.j2ssh.transport.cipher.SshCipherFactory;
+import com.sshtools.j2ssh.transport.hmac.SshHmacFactory;
+import com.sshtools.j2ssh.transport.publickey.SshPrivateKey;
+import com.sshtools.j2ssh.transport.publickey.SshPrivateKeyFile;
+
+public class Ssh {
+ static Logger logger = Logger.getLogger(Ssh.class.getName());
+ protected String host;
+ protected int port = 22;
+ protected String username;
+ protected String password;
+ protected String keyfile;
+ protected String passphrase;
+ protected String cipher;
+ protected String mac;
+ protected String fingerprint;
+ protected String logfile = "ssh.log";
+ protected boolean verifyhost = true;
+ protected boolean always = false;
+ protected SshClient client;
+ protected String sshtoolsHome;
+ protected SessionChannelClient session = null;
+ private boolean connected, connecting;
+
+ static {
+ if (System.getProperty("sshtools.home") == null) {
+ System.setProperty("sshtools.home", System.getProperty("user.home")
+ + File.separator + ".globus");
+ }
+ File dir = new File(System.getProperty("sshtools.home"), "conf");
+ if (!dir.exists()) {
+ if (!dir.mkdirs()) {
+ throw new RuntimeException("Cannot create "
+ + dir.getAbsolutePath()
+ + ". Please check if you have a .globus directory"
+ + "in your home directory, and that it is writable");
+ }
+ }
+ else if (!dir.isDirectory()) {
+ throw new RuntimeException("Cannot create directory: "
+ + dir.getAbsolutePath()
+ + ". A file with that name already exists");
+ }
+ File hosts = new File(dir, "hosts.xml");
+ if (!hosts.exists()) {
+ try {
+ FileWriter w = new FileWriter(hosts);
+ w.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
+ w.write("<HostAuthorizations>\n");
+ w
+ .write("<!-- please consult the j2ssh documentation for details on this file -->\n");
+ w.write("</HostAuthorizations>\n");
+ w.close();
+ }
+ catch (IOException e) {
+ throw new RuntimeException(
+ "Cannot create hosts.xml file. Please check if you have a .globus directory"
+ + "in your home directory, and that it is writable",
+ e);
+ }
+ }
+ }
+
+ public Ssh() {
+ setVerifyhost(false);
+ }
+
+ public SessionChannelClient openSessionChannel() throws IOException {
+ return client.openSessionChannel();
+ }
+
+ public void connect() throws InvalidSecurityContextException,
+ InvalidServiceContactException, TaskSubmissionException {
+ try {
+ if (host == null) {
+ throw new InvalidServiceContactException(
+ "You must provide a host to connect to.");
+ }
+
+ if (username == null) {
+ throw new InvalidSecurityContextException(
+ "You must supply a username for authentication.");
+ }
+
+ if ((password == null) && (keyfile == null)) {
+ throw new InvalidSecurityContextException(
+ "You must supply either a password or keyfile/passphrase to authenticate!");
+ }
+
+ if (verifyhost && (fingerprint == null)) {
+ throw new InvalidSecurityContextException(
+ "Public key fingerprint required to verify the host");
+ }
+
+ if (sshtoolsHome != null) {
+ System.setProperty("sshtools.home", sshtoolsHome);
+ }
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("Initializing J2SSH");
+ }
+
+ if (logfile != null) {
+ System.setProperty("sshtools.logfile", logfile);
+ }
+
+ ConfigurationLoader.initialize(false);
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("Creating connection to " + host + ":"
+ + String.valueOf(port));
+ }
+
+ if (client == null) {
+ client = new SshClient();
+
+ SshConnectionProperties properties = new SshConnectionProperties();
+ properties.setHost(host);
+ properties.setPort(port);
+ properties.setUsername(username);
+
+ if (cipher != null) {
+ if (SshCipherFactory.getSupportedCiphers().contains(cipher)) {
+ properties.setPrefSCEncryption(cipher);
+ properties.setPrefCSEncryption(cipher);
+ }
+ else {
+ if (logger.isDebugEnabled()) {
+ logger
+ .debug(cipher
+ + " is not a supported cipher, using default "
+ + SshCipherFactory
+ .getDefaultCipher());
+ }
+ }
+ }
+
+ if (mac != null) {
+ if (SshHmacFactory.getSupportedMacs().contains(mac)) {
+ properties.setPrefCSMac(mac);
+ properties.setPrefSCMac(mac);
+ }
+ else {
+ if (logger.isDebugEnabled()) {
+ logger.debug(mac
+ + " is not a supported mac, using default "
+ + SshHmacFactory.getDefaultHmac());
+ }
+ }
+ }
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("Connecting....");
+ }
+
+ client.connect(properties, new AbstractHostKeyVerification() {
+ public void onUnknownHost(String hostname,
+ String fingerprint) throws InvalidHostFileException {
+ if (Ssh.this.verifyhost) {
+ if (fingerprint
+ .equalsIgnoreCase(Ssh.this.fingerprint)) {
+ allowHost(hostname, fingerprint, always);
+ }
+ }
+ else {
+ allowHost(hostname, fingerprint, always);
+ }
+ }
+
+ public void onHostKeyMismatch(String hostname,
+ String allowed, String supplied)
+ throws InvalidHostFileException {
+ if (Ssh.this.verifyhost) {
+ if (supplied.equalsIgnoreCase(Ssh.this.fingerprint)) {
+ allowHost(hostname, supplied, always);
+ }
+ }
+ else {
+ allowHost(hostname, supplied, always);
+ }
+ }
+
+ public void onDeniedHost(String host) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("The server host key is denied!");
+ }
+ }
+ });
+
+ int result;
+ boolean authenticated = false;
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("Authenticating " + username);
+ }
+
+ if (keyfile != null) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("Performing public key authentication");
+ }
+
+ PublicKeyAuthenticationClient pk = new PublicKeyAuthenticationClient();
+
+ // Open up the private key file
+ SshPrivateKeyFile file = SshPrivateKeyFile.parse(new File(
+ keyfile));
+
+ // If the private key is passphrase protected then ask for
+ // the passphrase
+ if (file.isPassphraseProtected() && (passphrase == null)) {
+ throw new InvalidSecurityContextException(
+ "Private key file is passphrase protected, please supply a valid passphrase");
+ }
+
+ // Get the key
+ SshPrivateKey key = file.toPrivateKey(passphrase);
+ pk.setUsername(username);
+ pk.setKey(key);
+
+ // Try the authentication
+ result = client.authenticate(pk);
+
+ if (result == AuthenticationProtocolState.COMPLETE) {
+ authenticated = true;
+ }
+ else if (result == AuthenticationProtocolState.PARTIAL) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("Public key authentication "
+ + "completed, attempting password authentication");
+ }
+ }
+ else {
+ throw new InvalidSecurityContextException(
+ "Public Key Authentication failed");
+ }
+ }
+
+ if ((password != null) && (authenticated == false)) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("Performing password authentication");
+ }
+
+ PasswordAuthenticationClient pwd = new PasswordAuthenticationClient();
+ pwd.setUsername(username);
+ pwd.setPassword(password);
+
+ result = client.authenticate(pwd);
+
+ if (result == AuthenticationProtocolState.COMPLETE) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("Authentication complete");
+ }
+ }
+ else if (result == AuthenticationProtocolState.PARTIAL) {
+ if (logger.isDebugEnabled()) {
+ logger.error("Password Authentication succeeded "
+ + "but further authentication required!");
+ }
+ }
+ else {
+ throw new InvalidSecurityContextException(
+ "Password Authentication failed");
+ }
+ }
+ }
+
+ }
+ catch (IOException sshe) {
+ logger.debug(sshe);
+ throw new TaskSubmissionException("SSH Connection failed: "
+ + sshe.getMessage());
+ }
+ }
+
+ public void setUsername(String username) {
+ this.username = username;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+ public void setPort(int port) {
+ this.port = port;
+ }
+
+ public void setHost(String host) {
+ this.host = host;
+ }
+
+ public void setKeyfile(String keyfile) {
+ this.keyfile = keyfile;
+ }
+
+ public void setPassphrase(String passphrase) {
+ this.passphrase = passphrase;
+ }
+
+ public void setCipher(String cipher) {
+ this.cipher = cipher;
+ }
+
+ public void setMac(String mac) {
+ this.mac = mac;
+ }
+
+ public void setLogfile(String logfile) {
+ this.logfile = logfile;
+ }
+
+ public void setVerifyhost(boolean verifyhost) {
+ this.verifyhost = verifyhost;
+ }
+
+ public void setAlways(boolean always) {
+ this.always = always;
+ }
+
+ public void setSshtoolshome(String sshtoolsHome) {
+ this.sshtoolsHome = sshtoolsHome;
+ }
+
+ public void disconnect() {
+ client.disconnect();
+ }
+
+}
Added: trunk/current/src/cog/modules/provider-ssh/src/org/globus/cog/abstraction/impl/ssh/execution/DelegatedTaskHandlerFactory.java
===================================================================
--- trunk/current/src/cog/modules/provider-ssh/src/org/globus/cog/abstraction/impl/ssh/execution/DelegatedTaskHandlerFactory.java (rev 0)
+++ trunk/current/src/cog/modules/provider-ssh/src/org/globus/cog/abstraction/impl/ssh/execution/DelegatedTaskHandlerFactory.java 2007-11-23 21:24:48 UTC (rev 1840)
@@ -0,0 +1,27 @@
+// ----------------------------------------------------------------------
+// This code is developed as part of the Java CoG Kit project
+// The terms of the license can be found at http://www.cogkit.org/license
+// This message may not be removed or altered.
+// ----------------------------------------------------------------------
+
+
+
+package org.globus.cog.abstraction.impl.ssh.execution;
+
+import org.globus.cog.abstraction.interfaces.DelegatedTaskHandler;
+import org.globus.cog.abstraction.interfaces.Task;
+
+publ...
[truncated message content] |
|
From: <ha...@us...> - 2007-11-23 21:22:41
|
Revision: 1839
http://cogkit.svn.sourceforge.net/cogkit/?rev=1839&view=rev
Author: hategan
Date: 2007-11-23 13:22:40 -0800 (Fri, 23 Nov 2007)
Log Message:
-----------
changes
Modified Paths:
--------------
trunk/current/src/cog/modules/abstraction-common/CHANGES.txt
Modified: trunk/current/src/cog/modules/abstraction-common/CHANGES.txt
===================================================================
--- trunk/current/src/cog/modules/abstraction-common/CHANGES.txt 2007-11-23 21:21:27 UTC (rev 1838)
+++ trunk/current/src/cog/modules/abstraction-common/CHANGES.txt 2007-11-23 21:22:40 UTC (rev 1839)
@@ -1,3 +1,10 @@
+(11/23/2007)
+
+*** Fixed broken isDirectory file operation
+
+*** Caching of file resources happens on both host name, port and
+ provider rather than just the host name
+
(08/23/2007)
*** Added ability to query for a list of providers supporting
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ha...@us...> - 2007-11-23 21:21:28
|
Revision: 1838
http://cogkit.svn.sourceforge.net/cogkit/?rev=1838&view=rev
Author: hategan
Date: 2007-11-23 13:21:27 -0800 (Fri, 23 Nov 2007)
Log Message:
-----------
all ops lowercase
Modified Paths:
--------------
trunk/current/src/cog/modules/abstraction-common/src/org/globus/cog/abstraction/interfaces/FileOperationSpecification.java
Modified: trunk/current/src/cog/modules/abstraction-common/src/org/globus/cog/abstraction/interfaces/FileOperationSpecification.java
===================================================================
--- trunk/current/src/cog/modules/abstraction-common/src/org/globus/cog/abstraction/interfaces/FileOperationSpecification.java 2007-11-23 21:20:40 UTC (rev 1837)
+++ trunk/current/src/cog/modules/abstraction-common/src/org/globus/cog/abstraction/interfaces/FileOperationSpecification.java 2007-11-23 21:21:27 UTC (rev 1838)
@@ -110,7 +110,7 @@
* Indicated whether a file with the given name is a directory on the remote
* resource
*/
- public static final String ISDIRECTORY = "isDirectory";
+ public static final String ISDIRECTORY = "isdirectory";
/**
* Get info about a file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ha...@us...> - 2007-11-23 21:20:46
|
Revision: 1837
http://cogkit.svn.sourceforge.net/cogkit/?rev=1837&view=rev
Author: hategan
Date: 2007-11-23 13:20:40 -0800 (Fri, 23 Nov 2007)
Log Message:
-----------
added toString for pka
Modified Paths:
--------------
trunk/current/src/cog/modules/abstraction-common/src/org/globus/cog/abstraction/impl/common/PublicKeyAuthentication.java
Modified: trunk/current/src/cog/modules/abstraction-common/src/org/globus/cog/abstraction/impl/common/PublicKeyAuthentication.java
===================================================================
--- trunk/current/src/cog/modules/abstraction-common/src/org/globus/cog/abstraction/impl/common/PublicKeyAuthentication.java 2007-11-23 21:20:07 UTC (rev 1836)
+++ trunk/current/src/cog/modules/abstraction-common/src/org/globus/cog/abstraction/impl/common/PublicKeyAuthentication.java 2007-11-23 21:20:40 UTC (rev 1837)
@@ -53,4 +53,8 @@
public void setUsername(String username) {
this.username = username;
}
+
+ public String toString() {
+ return username + ":<key>";
+ }
}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ha...@us...> - 2007-11-23 21:20:12
|
Revision: 1836
http://cogkit.svn.sourceforge.net/cogkit/?rev=1836&view=rev
Author: hategan
Date: 2007-11-23 13:20:07 -0800 (Fri, 23 Nov 2007)
Log Message:
-----------
cache on the whole service (including provider) rather than only the host name
Modified Paths:
--------------
trunk/current/src/cog/modules/abstraction-common/src/org/globus/cog/abstraction/impl/file/FileResourceCache.java
Modified: trunk/current/src/cog/modules/abstraction-common/src/org/globus/cog/abstraction/impl/file/FileResourceCache.java
===================================================================
--- trunk/current/src/cog/modules/abstraction-common/src/org/globus/cog/abstraction/impl/file/FileResourceCache.java 2007-11-09 23:55:06 UTC (rev 1835)
+++ trunk/current/src/cog/modules/abstraction-common/src/org/globus/cog/abstraction/impl/file/FileResourceCache.java 2007-11-23 21:20:07 UTC (rev 1836)
@@ -10,6 +10,7 @@
package org.globus.cog.abstraction.impl.file;
import java.io.IOException;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.Iterator;
@@ -28,7 +29,6 @@
import org.globus.cog.abstraction.interfaces.FileResource;
import org.globus.cog.abstraction.interfaces.SecurityContext;
import org.globus.cog.abstraction.interfaces.Service;
-import org.globus.cog.abstraction.interfaces.ServiceContact;
public class FileResourceCache {
private static Logger logger = Logger.getLogger(FileResourceCache.class);
@@ -47,7 +47,7 @@
private LinkedList order;
private Map releaseTimes;
- private Map fileResources;
+ private Map fileResources, services;
private Set invalid;
private Set inUse;
private Timer timer;
@@ -56,11 +56,12 @@
private ResourceStopper stopper;
public FileResourceCache() {
- fileResources = new Hashtable();
+ fileResources = new HashMap();
+ services = new HashMap();
inUse = new HashSet();
invalid = new HashSet();
order = new LinkedList();
- releaseTimes = new Hashtable();
+ releaseTimes = new HashMap();
stopper = new ResourceStopper();
}
@@ -72,11 +73,10 @@
logger.debug("Got request for resource for " + service);
}
checkTimer();
- ServiceContact contact = service.getServiceContact();
FileResource fileResource;
synchronized (this) {
- if (fileResources.containsKey(contact)) {
- List resources = (List) fileResources.get(contact);
+ if (fileResources.containsKey(service)) {
+ List resources = (List) fileResources.get(service);
Iterator i = resources.iterator();
while (i.hasNext()) {
fileResource = (FileResource) i.next();
@@ -111,7 +111,6 @@
logger.debug("Instantiating new resource for " + service);
}
String provider = service.getProvider();
- ServiceContact contact = service.getServiceContact();
if (provider == null) {
throw new InvalidProviderException("Provider is null");
}
@@ -121,17 +120,18 @@
}
FileResource fileResource = AbstractionFactory
.newFileResource(provider);
- fileResource.setServiceContact(contact);
+ fileResource.setServiceContact(service.getServiceContact());
fileResource.setSecurityContext(securityContext);
List resources;
- if (fileResources.containsKey(contact)) {
- resources = (List) fileResources.get(contact);
+ if (fileResources.containsKey(service)) {
+ resources = (List) fileResources.get(service);
}
else {
resources = new LinkedList();
- fileResources.put(contact, resources);
+ fileResources.put(service, resources);
}
resources.add(fileResource);
+ services.put(fileResource, service);
inUse.add(fileResource);
return fileResource;
}
@@ -184,9 +184,12 @@
private void removeResource(FileResource resource) {
synchronized (this) {
- if (fileResources.containsKey(resource.getServiceContact())) {
- List resources = (List) fileResources.get(resource
- .getServiceContact());
+ Service service = (Service) services.remove(resource);
+ if (service == null) {
+ return;
+ }
+ if (fileResources.containsKey(service)) {
+ List resources = (List) fileResources.get(service);
resources.remove(resource);
stopper.addResource(resource);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ha...@us...> - 2007-11-09 23:55:09
|
Revision: 1835
http://cogkit.svn.sourceforge.net/cogkit/?rev=1835&view=rev
Author: hategan
Date: 2007-11-09 15:55:06 -0800 (Fri, 09 Nov 2007)
Log Message:
-----------
avoid conflicts with other hosts
Modified Paths:
--------------
trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/util/BoundContact.java
Modified: trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/util/BoundContact.java
===================================================================
--- trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/util/BoundContact.java 2007-11-09 22:09:59 UTC (rev 1834)
+++ trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/util/BoundContact.java 2007-11-09 23:55:06 UTC (rev 1835)
@@ -211,7 +211,9 @@
addService(fileService);
addService(transferService);
addService(executionService);
- setHost("localhost");
+ //TODO A better way to avoid this being equal to a host who happens
+ //to have the same name should be implemented
+ setHost("_localhost");
}
public Service getService(int type, String provider) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ha...@us...> - 2007-11-09 22:10:02
|
Revision: 1834
http://cogkit.svn.sourceforge.net/cogkit/?rev=1834&view=rev
Author: hategan
Date: 2007-11-09 14:09:59 -0800 (Fri, 09 Nov 2007)
Log Message:
-----------
cwd applies to all relative dirs
Modified Paths:
--------------
trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/nodes/grid/GridTransfer.java
Modified: trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/nodes/grid/GridTransfer.java
===================================================================
--- trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/nodes/grid/GridTransfer.java 2007-11-07 00:43:43 UTC (rev 1833)
+++ trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/nodes/grid/GridTransfer.java 2007-11-09 22:09:59 UTC (rev 1834)
@@ -111,9 +111,9 @@
if (A_THIRDPARTY.isPresent(stack)) {
fs.setThirdParty(TypeUtil.toBoolean(A_THIRDPARTY.getValue(stack)));
}
- else {
- fs.setThirdPartyIfPossible(true);
- }
+ else {
+ fs.setThirdPartyIfPossible(true);
+ }
if (A_SRCOFFSET.isPresent(stack)) {
fs.setSourceOffset(TypeUtil.toNumber(A_SRCOFFSET.getValue(stack)).longValue());
@@ -132,13 +132,16 @@
TypeUtil.toString(A_TCP_BUFSZ.getValue(stack)));
}
- if (sourceContact.equals(BoundContact.LOCALHOST) && fs.getSourceDirectory().equals("")) {
- fs.setSourceDirectory(stack.getExecutionContext().getCwd());
+ if (sourceContact.equals(BoundContact.LOCALHOST)
+ && isRelative(fs.getSourceDirectory())) {
+ fs.setSourceDirectory(pathcat(stack.getExecutionContext().getCwd(),
+ fs.getSourceDirectory()));
}
if (destinationContact.equals(BoundContact.LOCALHOST)
- && fs.getDestinationDirectory().equals("")) {
- fs.setDestinationDirectory(stack.getExecutionContext().getCwd());
+ && isRelative(fs.getDestinationDirectory())) {
+ fs.setDestinationDirectory(pathcat(stack.getExecutionContext().getCwd(),
+ fs.getDestinationDirectory()));
}
task.setType(Task.FILE_TRANSFER);
@@ -191,6 +194,19 @@
}
}
+ private boolean isRelative(String dir) {
+ return dir == null || !new File(dir).isAbsolute();
+ }
+
+ private String pathcat(String a, String b) {
+ if (b == null) {
+ return a;
+ }
+ else {
+ return a + File.separator + b;
+ }
+ }
+
private static synchronized Timer getTimer() {
if (timer == null) {
timer = new Timer();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
Revision: 1833
http://cogkit.svn.sourceforge.net/cogkit/?rev=1833&view=rev
Author: hategan
Date: 2007-11-06 16:43:43 -0800 (Tue, 06 Nov 2007)
Log Message:
-----------
removed useless and race condition causing state
Modified Paths:
--------------
trunk/current/src/cog/modules/abstraction-common/src/org/globus/cog/abstraction/impl/fileTransfer/DelegatedFileTransferHandler.java
Modified: trunk/current/src/cog/modules/abstraction-common/src/org/globus/cog/abstraction/impl/fileTransfer/DelegatedFileTransferHandler.java
===================================================================
--- trunk/current/src/cog/modules/abstraction-common/src/org/globus/cog/abstraction/impl/fileTransfer/DelegatedFileTransferHandler.java 2007-11-06 19:20:38 UTC (rev 1832)
+++ trunk/current/src/cog/modules/abstraction-common/src/org/globus/cog/abstraction/impl/fileTransfer/DelegatedFileTransferHandler.java 2007-11-07 00:43:43 UTC (rev 1833)
@@ -86,7 +86,6 @@
Thread thread = new Thread(this);
this.task.setStatus(Status.SUBMITTED);
thread.start();
- this.task.setStatus(Status.ACTIVE);
}
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bo...@us...> - 2007-11-06 19:20:40
|
Revision: 1832
http://cogkit.svn.sourceforge.net/cogkit/?rev=1832&view=rev
Author: boris_w
Date: 2007-11-06 11:20:38 -0800 (Tue, 06 Nov 2007)
Log Message:
-----------
moved an updated the README, cleaned the deserted directory
Added Paths:
-----------
trunk/cyberaide/example/jaxws/README.txt
Removed Paths:
-------------
trunk/cyberaide/src/jaxws/
Copied: trunk/cyberaide/example/jaxws/README.txt (from rev 1831, trunk/cyberaide/src/jaxws/test/README.txt)
===================================================================
--- trunk/cyberaide/example/jaxws/README.txt (rev 0)
+++ trunk/cyberaide/example/jaxws/README.txt 2007-11-06 19:20:38 UTC (rev 1832)
@@ -0,0 +1,12 @@
+This directory contains examples of webservice-clients and servers
+
+./server/ contains the test-server using the JAX-WS bundled in Java
+./client/ contains the different test-clients that connect to the server.
+ Currently clients in Java and Ruby are existing
+
+./server/org/[...]/circlefunctions/ contains a test example to deploy a web service using jaxws
+./server/org/[...]/multipleservice/ contains a test example to deploy two web services at one host using jaxws
+./client/ruby contains a simple ruby-client that consumes from the circlefunctions-server
+./client/java/org/[...]/multipleservice/ contains a single java client program that consumes the two services
+
+The build class files and stubs generated by wsgen and wsimport are stored in /cyberaide/build/org/cogkit/cyberaide/jaxws/; the generated wsdl files are stored in /cyberaide/build/wsdl
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ha...@us...> - 2007-11-05 16:13:14
|
Revision: 1830
http://cogkit.svn.sourceforge.net/cogkit/?rev=1830&view=rev
Author: hategan
Date: 2007-11-05 08:13:12 -0800 (Mon, 05 Nov 2007)
Log Message:
-----------
fixed call to wrong method
Modified Paths:
--------------
trunk/current/src/cog/modules/provider-gt2/src/org/globus/cog/abstraction/impl/file/gridftp/old/FileResourceImpl.java
Modified: trunk/current/src/cog/modules/provider-gt2/src/org/globus/cog/abstraction/impl/file/gridftp/old/FileResourceImpl.java
===================================================================
--- trunk/current/src/cog/modules/provider-gt2/src/org/globus/cog/abstraction/impl/file/gridftp/old/FileResourceImpl.java 2007-11-03 04:46:50 UTC (rev 1829)
+++ trunk/current/src/cog/modules/provider-gt2/src/org/globus/cog/abstraction/impl/file/gridftp/old/FileResourceImpl.java 2007-11-05 16:13:12 UTC (rev 1830)
@@ -344,7 +344,7 @@
public void putFile(String localFileName, String remoteFileName)
throws FileResourceException {
- putFile(localFileName, remoteFileName);
+ putFile(localFileName, remoteFileName, null);
}
/** Copy a local file to a remote file. Default option 'overwrite' */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fug...@us...> - 2007-11-02 18:33:59
|
Revision: 1827
http://cogkit.svn.sourceforge.net/cogkit/?rev=1827&view=rev
Author: fugangwang
Date: 2007-11-02 11:33:58 -0700 (Fri, 02 Nov 2007)
Log Message:
-----------
restore the src directory
Added Paths:
-----------
trunk/cyberaide/src/README.txt
trunk/cyberaide/src/axis2/
trunk/cyberaide/src/axis2/README.txt
trunk/cyberaide/src/jaxws/
trunk/cyberaide/src/jaxws/test/
trunk/cyberaide/src/jaxws/test/README.txt
trunk/cyberaide/src/jaxws/test/testCircleService/
trunk/cyberaide/src/jaxws/test/testCircleService/CircleFunctions.java
trunk/cyberaide/src/jaxws/test/testCircleService/Makefile
trunk/cyberaide/src/jaxws/test/testCircleService/TestCircleFunctions.java
trunk/cyberaide/src/jaxws/test/testCircleService/stop.sh
trunk/cyberaide/src/jaxws/test/testMultipleService/
trunk/cyberaide/src/jaxws/test/testMultipleService/CircleFunctions.java
trunk/cyberaide/src/jaxws/test/testMultipleService/Makefile
trunk/cyberaide/src/jaxws/test/testMultipleService/SquareFunctions.java
trunk/cyberaide/src/jaxws/test/testMultipleService/TestMultipleService.java
trunk/cyberaide/src/jaxws/test/testMultipleService/stop.sh
trunk/cyberaide/src/js/
trunk/cyberaide/src/js/README.txt
trunk/cyberaide/src/js/java/
trunk/cyberaide/src/js/java/CoGHandler/
trunk/cyberaide/src/js/java/CoGHandler/.classpath
trunk/cyberaide/src/js/java/CoGHandler/.project
trunk/cyberaide/src/js/java/CoGHandler/SimpleHandler.java
trunk/cyberaide/src/js/java/CoGHandler/SimpleHandlerStub.java
trunk/cyberaide/src/js/securelogin/
trunk/cyberaide/src/js/securelogin/WEB-INF/
trunk/cyberaide/src/js/securelogin/WEB-INF/classes/
trunk/cyberaide/src/js/securelogin/WEB-INF/classes/org/
trunk/cyberaide/src/js/securelogin/WEB-INF/classes/org/apache/
trunk/cyberaide/src/js/securelogin/WEB-INF/classes/org/apache/xmlrpc/
trunk/cyberaide/src/js/securelogin/WEB-INF/classes/org/apache/xmlrpc/webserver/
trunk/cyberaide/src/js/securelogin/WEB-INF/classes/org/apache/xmlrpc/webserver/XmlRpcServlet.properties
trunk/cyberaide/src/js/securelogin/WEB-INF/classes/zhguo/
trunk/cyberaide/src/js/securelogin/WEB-INF/classes/zhguo/test/
trunk/cyberaide/src/js/securelogin/WEB-INF/web.xml
trunk/cyberaide/src/js/securelogin/cogkit/
trunk/cyberaide/src/js/securelogin/cogkit/CoGHandler.js
trunk/cyberaide/src/js/securelogin/www/
trunk/cyberaide/src/js/securelogin/www/error.html
trunk/cyberaide/src/js/securelogin/www/index.html
trunk/cyberaide/src/js/securelogin/www/login.html
Added: trunk/cyberaide/src/README.txt
===================================================================
--- trunk/cyberaide/src/README.txt (rev 0)
+++ trunk/cyberaide/src/README.txt 2007-11-02 18:33:58 UTC (rev 1827)
@@ -0,0 +1 @@
+see ../README.txt
Added: trunk/cyberaide/src/axis2/README.txt
===================================================================
--- trunk/cyberaide/src/axis2/README.txt (rev 0)
+++ trunk/cyberaide/src/axis2/README.txt 2007-11-02 18:33:58 UTC (rev 1827)
@@ -0,0 +1 @@
+see ../../README.txt
Added: trunk/cyberaide/src/jaxws/test/README.txt
===================================================================
--- trunk/cyberaide/src/jaxws/test/README.txt (rev 0)
+++ trunk/cyberaide/src/jaxws/test/README.txt 2007-11-02 18:33:58 UTC (rev 1827)
@@ -0,0 +1,3 @@
+./testCircleService/ contains a test example to deploy a web service using jaxws and consume it from a java client program
+./testMultipleService/ contains a test example to deploy two web services at one host using jaxws and consume the two services from a single java client program
+The build class files and stubs generated by wsgen and wsimport are stored in /cyberaide/build/org/cogkit/cyberaide/jaxws/test; the generated wsdl files are stored in /cyberaide/build/wsdl
Added: trunk/cyberaide/src/jaxws/test/testCircleService/CircleFunctions.java
===================================================================
--- trunk/cyberaide/src/jaxws/test/testCircleService/CircleFunctions.java (rev 0)
+++ trunk/cyberaide/src/jaxws/test/testCircleService/CircleFunctions.java 2007-11-02 18:33:58 UTC (rev 1827)
@@ -0,0 +1,44 @@
+/*
+ * CircleFunctions.java
+ *
+ * @version:
+ * $Id v1.2$
+ *
+ * Revisions:
+ * 10/28/2007 Initial version
+ * 11/01/2007 modify package name
+ * modify package name to use in multiple service deployment
+ * 11/02/2007 modify package name to fit into the global project
+ */
+package org.cogkit.cyberaide.jaxws.test.circlefunctions.service;
+
+import javax.jws.WebService;
+import javax.xml.ws.Endpoint;
+
+@WebService
+public class CircleFunctions {
+
+ /*
+ * return area of a circle
+ */
+ public double getArea(double r) {
+ return java.lang.Math.PI * (r * r);
+ }
+
+ /*
+ * return circumference of a circle
+ */
+ public double getCircumference(double r) {
+ return 2 * java.lang.Math.PI * r;
+ }
+
+ /*
+ * publish the service
+ */
+ public static void main(String[] args) {
+
+ Endpoint.publish(
+ "http://localhost:8080/jaxws/circlefunctions",
+ new CircleFunctions());
+ }
+}
Added: trunk/cyberaide/src/jaxws/test/testCircleService/Makefile
===================================================================
--- trunk/cyberaide/src/jaxws/test/testCircleService/Makefile (rev 0)
+++ trunk/cyberaide/src/jaxws/test/testCircleService/Makefile 2007-11-02 18:33:58 UTC (rev 1827)
@@ -0,0 +1,28 @@
+all: compile service client stop
+ @echo done
+
+init:
+ mkdir -p ../../../../build/wsdl/circlefunctions
+
+compile: init
+ javac -d ../../../../build/ CircleFunctions.java
+
+service:
+ @echo "Starting the two services..."
+ wsgen -cp ../../../../build/ -d ../../../../build/ -r ../../../../build/wsdl/circlefunctions/ -wsdl org.cogkit.cyberaide.jaxws.test.circlefunctions.service.CircleFunctions
+ java -cp ../../../../build/ org.cogkit.cyberaide.jaxws.test.circlefunctions.service.CircleFunctions &
+ sleep 2
+
+client:
+ @echo "Generating and running client..."
+ wsimport -keep -d ../../../../build/ -p org.cogkit.cyberaide.jaxws.test.circlefunctions.clientstub http://localhost:8080/jaxws/circlefunctions?WSDL
+ javac -cp ../../../../build/ -d ../../../../build/ TestCircleFunctions.java
+ java -cp ../../../../build/ org.cogkit.cyberaide.jaxws.test.circlefunctions.client.TestCircleFunctions
+
+stop:
+ @echo "Stopping services..."
+ sh stop.sh
+
+clean:
+ rm -fr ../../../../build/org/cogkit/cyberaide/jaxws/test/circlefunctions
+ rm -fr ../../../../build/wsdl/circlefunctions
Added: trunk/cyberaide/src/jaxws/test/testCircleService/TestCircleFunctions.java
===================================================================
--- trunk/cyberaide/src/jaxws/test/testCircleService/TestCircleFunctions.java (rev 0)
+++ trunk/cyberaide/src/jaxws/test/testCircleService/TestCircleFunctions.java 2007-11-02 18:33:58 UTC (rev 1827)
@@ -0,0 +1,56 @@
+/*
+ * TestCircleFunctions.java
+ *
+ * @version:
+ * $Id v1.0$
+ *
+ * Revisions:
+ * 11/01/2007 Initial version
+ * 11/02/2007 modify package name to fit into the global project
+ *
+ */
+package org.cogkit.cyberaide.jaxws.test.circlefunctions.client;
+
+import javax.xml.ws.Service;
+import javax.xml.ws.WebEndpoint;
+import org.cogkit.cyberaide.jaxws.test.circlefunctions.clientstub.*;
+import org.cogkit.cyberaide.jaxws.test.circlefunctions.clientstub.*;
+
+/**
+ * test circle functions services on a remote server
+ */
+public class TestCircleFunctions {
+ static CircleFunctionsService service = new CircleFunctionsService();
+
+ public static void main(String[] args) {
+ try {
+ TestCircleFunctions client = new TestCircleFunctions();
+ client.doTest(args);
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void doTest(String[] args) {
+ try {
+ System.out.println("------------------from Client running------------------");
+ System.out.println("Retrieving the port from the following service:\n\t " + service);
+ CircleFunctions port = service.getCircleFunctionsPort();
+ double radius,area,circumference;
+
+ System.out.println("Invoking the getArea operation on the port...");
+ System.out.print("Response from server:\n\tThe area of a circle with radius 10:");
+ radius = 10;
+ area = port.getArea(radius);
+ System.out.println( area );
+
+ System.out.println("Invoking the getCircumference operation on the port...");
+ System.out.print("Response from server:\n\tThe circumference of a circle with radius 10:");
+ circumference = port.getCircumference(radius);
+ System.out.println( circumference );
+
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+ }
+}
Added: trunk/cyberaide/src/jaxws/test/testCircleService/stop.sh
===================================================================
--- trunk/cyberaide/src/jaxws/test/testCircleService/stop.sh (rev 0)
+++ trunk/cyberaide/src/jaxws/test/testCircleService/stop.sh 2007-11-02 18:33:58 UTC (rev 1827)
@@ -0,0 +1 @@
+kill -9 `ps -a|grep java|awk '{print $1}'`
Added: trunk/cyberaide/src/jaxws/test/testMultipleService/CircleFunctions.java
===================================================================
--- trunk/cyberaide/src/jaxws/test/testMultipleService/CircleFunctions.java (rev 0)
+++ trunk/cyberaide/src/jaxws/test/testMultipleService/CircleFunctions.java 2007-11-02 18:33:58 UTC (rev 1827)
@@ -0,0 +1,44 @@
+/*
+ * CircleFunctions.java
+ *
+ * @version:
+ * $Id v1.2$
+ *
+ * Revisions:
+ * 10/28/2007 Initial version
+ * 11/01/2007 modify package name
+ * modify package name to use in multiple service deployment
+ * 11/02/2007 modify package name to fit into the global project
+ */
+package org.cogkit.cyberaide.jaxws.test.multipleservice.service.circle;
+
+import javax.jws.WebService;
+import javax.xml.ws.Endpoint;
+
+@WebService
+public class CircleFunctions {
+
+ /*
+ * return area of a circle
+ */
+ public double getArea(double r) {
+ return java.lang.Math.PI * (r * r);
+ }
+
+ /*
+ * return circumference of a circle
+ */
+ public double getCircumference(double r) {
+ return 2 * java.lang.Math.PI * r;
+ }
+
+ /*
+ * publish the service
+ */
+ public static void main(String[] args) {
+
+ Endpoint.publish(
+ "http://localhost:8080/jaxws/circlefunctions",
+ new CircleFunctions());
+ }
+}
Added: trunk/cyberaide/src/jaxws/test/testMultipleService/Makefile
===================================================================
--- trunk/cyberaide/src/jaxws/test/testMultipleService/Makefile (rev 0)
+++ trunk/cyberaide/src/jaxws/test/testMultipleService/Makefile 2007-11-02 18:33:58 UTC (rev 1827)
@@ -0,0 +1,33 @@
+all: compile service client stop
+ @echo done
+
+init:
+ mkdir -p ../../../../build/wsdl/multipleservice
+
+compile: init
+ javac -d ../../../../build/ CircleFunctions.java
+ javac -d ../../../../build/ SquareFunctions.java
+
+service:
+ @echo "Starting the two services..."
+ wsgen -cp ../../../../build/ -d ../../../../build/ -r ../../../../build/wsdl/multipleservice/ -wsdl org.cogkit.cyberaide.jaxws.test.multipleservice.service.circle.CircleFunctions
+ java -cp ../../../../build/ org.cogkit.cyberaide.jaxws.test.multipleservice.service.circle.CircleFunctions &
+ sleep 2
+ wsgen -cp ../../../../build/ -d ../../../../build/ -r ../../../../build/wsdl/multipleservice/ -wsdl org.cogkit.cyberaide.jaxws.test.multipleservice.service.square.SquareFunctions
+ java -cp ../../../../build/ org.cogkit.cyberaide.jaxws.test.multipleservice.service.square.SquareFunctions &
+ sleep 2
+
+client:
+ @echo "Generating and running client..."
+ wsimport -keep -d ../../../../build/ -p org.cogkit.cyberaide.jaxws.test.multipleservice.clientstub.circle http://localhost:8080/jaxws/circlefunctions?WSDL
+ wsimport -keep -d ../../../../build/ -p org.cogkit.cyberaide.jaxws.test.multipleservice.clientstub.square http://localhost:8180/jaxws/squarefunctions?WSDL
+ javac -cp ../../../../build/ -d ../../../../build/ TestMultipleService.java
+ java -cp ../../../../build/ org.cogkit.cyberaide.jaxws.test.multipleservice.client.TestMultipleService
+
+stop:
+ @echo "Stopping services..."
+ sh stop.sh
+
+clean:
+ rm -fr ../../../../build/org/cogkit/cyberaide/jaxws/test/multipleservice
+ rm -fr ../../../../build/wsdl/multipleservice
Added: trunk/cyberaide/src/jaxws/test/testMultipleService/SquareFunctions.java
===================================================================
--- trunk/cyberaide/src/jaxws/test/testMultipleService/SquareFunctions.java (rev 0)
+++ trunk/cyberaide/src/jaxws/test/testMultipleService/SquareFunctions.java 2007-11-02 18:33:58 UTC (rev 1827)
@@ -0,0 +1,43 @@
+/*
+ * SquareFunctions.java
+ *
+ * @version:
+ * $Id v1.0$
+ *
+ * Revisions:
+ * 11/01/2007 Initial version
+ * 11/02/2007 modify package name to fit into the global project
+ *
+ */
+package org.cogkit.cyberaide.jaxws.test.multipleservice.service.square;
+
+import javax.jws.WebService;
+import javax.xml.ws.Endpoint;
+
+@WebService
+public class SquareFunctions {
+
+ /*
+ * return area of a Square
+ */
+ public double getArea(double s) {
+ return (s * s);
+ }
+
+ /*
+ * return circumference of a Square
+ */
+ public double getCircumference(double s) {
+ return 4 * s;
+ }
+
+ /*
+ * publish the service
+ */
+ public static void main(String[] args) {
+
+ Endpoint.publish(
+ "http://localhost:8180/jaxws/squarefunctions",
+ new SquareFunctions());
+ }
+}
Added: trunk/cyberaide/src/jaxws/test/testMultipleService/TestMultipleService.java
===================================================================
--- trunk/cyberaide/src/jaxws/test/testMultipleService/TestMultipleService.java (rev 0)
+++ trunk/cyberaide/src/jaxws/test/testMultipleService/TestMultipleService.java 2007-11-02 18:33:58 UTC (rev 1827)
@@ -0,0 +1,74 @@
+/*
+ * TestMultipleService.java
+ *
+ * @version:
+ * $Id v1.0$
+ *
+ * Revisions:
+ * 11/01/2007 Initial version
+ * 11/02/2007 modify package name to fit into the global project
+ *
+ */
+package org.cogkit.cyberaide.jaxws.test.multipleservice.client;
+
+import javax.xml.ws.Service;
+import javax.xml.ws.WebEndpoint;
+import org.cogkit.cyberaide.jaxws.test.multipleservice.clientstub.circle.*;
+import org.cogkit.cyberaide.jaxws.test.multipleservice.clientstub.square.*;
+
+/**
+ * test consuming multiple services on a remote server
+ */
+public class TestMultipleService {
+ static CircleFunctionsService service1 = new CircleFunctionsService();
+ static SquareFunctionsService service2 = new SquareFunctionsService();
+
+ public static void main(String[] args) {
+ try {
+ TestMultipleService client = new TestMultipleService();
+ client.doTest(args);
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void doTest(String[] args) {
+ try {
+ System.out.println("------------------from Client running------------------");
+ System.out.println("----------try to call the first service----------");
+ System.out.println("Retrieving the port from the following service:\n\t " + service1);
+ CircleFunctions port1 = service1.getCircleFunctionsPort();
+ double radius,area,circumference;
+
+ System.out.println("Invoking the getArea operation on the port...");
+ System.out.print("Response from server:\n\tThe area of a circle with radius 10:");
+ radius = 10;
+ area = port1.getArea(radius);
+ System.out.println( area );
+
+ System.out.println("Invoking the getCircumference operation on the port...");
+ System.out.print("Response from server:\n\tThe circumference of a circle with radius 10:");
+ circumference = port1.getCircumference(radius);
+ System.out.println( circumference );
+
+ System.out.println("----------try to get to another service----------");
+ System.out.println("Retrieving the port from the following service:\n\t " + service2);
+ SquareFunctions port2 = service2.getSquareFunctionsPort();
+ double side = 10;
+
+ System.out.println("Invoking the getArea operation on the port...");
+ System.out.print("Response from server:\n\tThe area of a square with side 10:");
+ area = port2.getArea(radius);
+ System.out.println( area );
+
+ System.out.println("Invoking the getCircumference operation on the port...");
+ System.out.print("Response from server:\n\tThe circumference of a square with side 10:");
+ circumference = port2.getCircumference(radius);
+ System.out.println( circumference );
+
+
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+ }
+}
Added: trunk/cyberaide/src/jaxws/test/testMultipleService/stop.sh
===================================================================
--- trunk/cyberaide/src/jaxws/test/testMultipleService/stop.sh (rev 0)
+++ trunk/cyberaide/src/jaxws/test/testMultipleService/stop.sh 2007-11-02 18:33:58 UTC (rev 1827)
@@ -0,0 +1 @@
+kill -9 `ps -a|grep java|awk '{print $1}'`
Added: trunk/cyberaide/src/js/README.txt
===================================================================
--- trunk/cyberaide/src/js/README.txt (rev 0)
+++ trunk/cyberaide/src/js/README.txt 2007-11-02 18:33:58 UTC (rev 1827)
@@ -0,0 +1 @@
+see ../../README.txt
Added: trunk/cyberaide/src/js/java/CoGHandler/.classpath
===================================================================
--- trunk/cyberaide/src/js/java/CoGHandler/.classpath (rev 0)
+++ trunk/cyberaide/src/js/java/CoGHandler/.classpath 2007-11-02 18:33:58 UTC (rev 1827)
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/cyberaide/src/js/java/CoGHandler/.project
===================================================================
--- trunk/cyberaide/src/js/java/CoGHandler/.project (rev 0)
+++ trunk/cyberaide/src/js/java/CoGHandler/.project 2007-11-02 18:33:58 UTC (rev 1827)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>COGHandler</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/cyberaide/src/js/java/CoGHandler/SimpleHandler.java
===================================================================
--- trunk/cyberaide/src/js/java/CoGHandler/SimpleHandler.java (rev 0)
+++ trunk/cyberaide/src/js/java/CoGHandler/SimpleHandler.java 2007-11-02 18:33:58 UTC (rev 1827)
@@ -0,0 +1,94 @@
+package org.cogkit.cyberaide.???.CoGHandler.test;
+
+import java.io.*;
+
+import org.cogkit.cyberaide.???.CoGHandler.test.SimpleHandlerStub.Echo;
+import org.cogkit.cyberaide.???.CoGHandler.test.SimpleHandlerStub.EchoResponse;
+import org.cogkit.cyberaide.???.CoGHandler.test.SimpleHandlerStub.CmdCOGExecute;
+import org.cogkit.cyberaide.???.CoGHandler.test.SimpleHandlerStub.CmdCOGExecuteResponse;
+
+/*
+ * It is to be used to XML-RPC framework.
+ */
+
+
+/*
+ String apache_home = E:\\Prog ...
+ String service_home = http:/loca ....
+ String WEBINF_home = ....
+ String cog_workflow_exe = .....
+
+ long timeout = ....
+*/
+
+public class SimpleHandler{
+// private
+ public SimpleHandler (){}
+
+ public String echo (String input){
+ try{
+ //write input into a file for logging
+ File recordfile = new File("E:\\Program Files\\Apache Software Foundation\\Tomcat 6.0\\webapps\\sample\\WEB-INF\\parameters.txt");
+ BufferedWriter br = new BufferedWriter(new FileWriter( recordfile ));
+ br.write (input);
+ br.close();
+ }catch (Exception e ){
+ System.exit (1);
+ }
+
+ SimpleHandlerStub stub
+ = new SimpleHandlerStub("http://localhost:8080/axis2/services/SimpleHandler");
+ Echo req = new Echo();
+ req.setInput (input);
+ EchoResponse resp = new EchoResponse();
+
+ //call the corresponding web service
+ return "Your input is:\n" + input;
+ }
+ public static int add (OperationInterfaceStub stub) {
+ try {
+ Add req = new Add();
+ req.setParam0(op1);
+ req.setParam1(op2);
+ AddResponse resp = new AddResponse();
+ resp = stub.add(req);
+ System.out.println("done");
+ System.out.println(op1 + "+"+ op2 + " is " + resp.get_return());
+ return resp.get_return();
+ } catch (Exception e) {
+ e.printStackTrace();
+ System.out.println("\n\n\n");
+ }
+ return 0;
+ }
+
+ public String cmdCOGExecute( String workflow ){
+ Process wfproc = null;
+ int exit = -1;
+ try {
+ String filename = "E:\\Program Files\\Apache Software Foundation\\Tomcat 6.0\\webapps\\sample\\WEB-INF\\workflow.xml";
+ File recordfile = new File(filename);
+ BufferedWriter br = new BufferedWriter(new FileWriter(recordfile));
+ br.write(workflow);
+ br.close();
+
+ String cmd = "E:\\my_program\\cog-4_1_5\\bin\\cog-workflow.bat " + filename;
+ long timeout = 1000 * 5;
+ wfproc = Runtime.getRuntime().exec(cmd);
+ synchronized(wfproc) {
+ wfproc.wait(timeout);
+ }
+ exit = wfproc.exitValue();
+ } catch (IllegalThreadStateException e) {
+ //if the thread
+ wfproc.destroy();
+ return e.toString();
+ } catch (Exception e){
+ return e.toString();
+ }
+ return "exit value " + String.valueOf(exit);
+ }
+ public static void main( String []args ){
+ SimpleHandler hd = new SimpleHandler();
+ }
+}
\ No newline at end of file
Added: trunk/cyberaide/src/js/java/CoGHandler/SimpleHandlerStub.java
===================================================================
--- trunk/cyberaide/src/js/java/CoGHandler/SimpleHandlerStub.java (rev 0)
+++ trunk/cyberaide/src/js/java/CoGHandler/SimpleHandlerStub.java 2007-11-02 18:33:58 UTC (rev 1827)
@@ -0,0 +1,2882 @@
+/**
+ * SimpleHandlerStub.java
+ *
+ * This file was auto-generated from WSDL
+ * by the Apache Axis2 version: 1.3 Built on : Aug 10, 2007 (04:45:47 LKT)
+ */
+package zhguo.test;
+
+
+/*
+ * SimpleHandlerStub java implementation
+ */
+public class SimpleHandlerStub extends org.apache.axis2.client.Stub {
+ protected org.apache.axis2.description.AxisOperation[] _operations;
+
+ //hashmaps to keep the fault mapping
+ private java.util.HashMap faultExceptionNameMap = new java.util.HashMap();
+ private java.util.HashMap faultExceptionClassNameMap = new java.util.HashMap();
+ private java.util.HashMap faultMessageMap = new java.util.HashMap();
+ private javax.xml.namespace.QName[] opNameArray = null;
+
+ /**
+ *Constructor that takes in a configContext
+ */
+ public SimpleHandlerStub(
+ org.apache.axis2.context.ConfigurationContext configurationContext,
+ java.lang.String targetEndpoint) throws org.apache.axis2.AxisFault {
+ this(configurationContext, targetEndpoint, false);
+ }
+
+ /**
+ * Constructor that takes in a configContext and useseperate listner
+ */
+ public SimpleHandlerStub(
+ org.apache.axis2.context.ConfigurationContext configurationContext,
+ java.lang.String targetEndpoint, boolean useSeparateListener)
+ throws org.apache.axis2.AxisFault {
+ //To populate AxisService
+ populateAxisService();
+ populateFaults();
+
+ _serviceClient = new org.apache.axis2.client.ServiceClient(configurationContext,
+ _service);
+
+ configurationContext = _serviceClient.getServiceContext()
+ .getConfigurationContext();
+
+ _serviceClient.getOptions()
+ .setTo(new org.apache.axis2.addressing.EndpointReference(
+ targetEndpoint));
+ _serviceClient.getOptions().setUseSeparateListener(useSeparateListener);
+
+ //Set the soap version
+ _serviceClient.getOptions()
+ .setSoapVersionURI(org.apache.axiom.soap.SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
+ }
+
+ /**
+ * Default Constructor
+ */
+ public SimpleHandlerStub(
+ org.apache.axis2.context.ConfigurationContext configurationContext)
+ throws org.apache.axis2.AxisFault {
+ this(configurationContext,
+ "http://localhost:8080/axis2/services/SimpleHandler");
+ }
+
+ /**
+ * Default Constructor
+ */
+ public SimpleHandlerStub() throws org.apache.axis2.AxisFault {
+ this("http://localhost:8080/axis2/services/SimpleHandler");
+ }
+
+ /**
+ * Constructor taking the target endpoint
+ */
+ public SimpleHandlerStub(java.lang.String targetEndpoint)
+ throws org.apache.axis2.AxisFault {
+ this(null, targetEndpoint);
+ }
+
+ private void populateAxisService() throws org.apache.axis2.AxisFault {
+ //creating the Service with a unique name
+ _service = new org.apache.axis2.description.AxisService("SimpleHandler" +
+ this.hashCode());
+
+ //creating the operations
+ org.apache.axis2.description.AxisOperation __operation;
+
+ _operations = new org.apache.axis2.description.AxisOperation[3];
+
+ __operation = new org.apache.axis2.description.OutOnlyAxisOperation();
+
+ __operation.setName(new javax.xml.namespace.QName("http://test.zhguo",
+ "main"));
+ _service.addOperation(__operation);
+
+ _operations[0] = __operation;
+
+ __operation = new org.apache.axis2.description.OutInAxisOperation();
+
+ __operation.setName(new javax.xml.namespace.QName("http://test.zhguo",
+ "cmdCOGExecute"));
+ _service.addOperation(__operation);
+
+ _operations[1] = __operation;
+
+ __operation = new org.apache.axis2.description.OutInAxisOperation();
+
+ __operation.setName(new javax.xml.namespace.QName("http://test.zhguo",
+ "echo"));
+ _service.addOperation(__operation);
+
+ _operations[2] = __operation;
+ }
+
+ //populates the faults
+ private void populateFaults() {
+ }
+
+ public void main(zhguo.test.SimpleHandlerStub.Main main)
+ throws java.rmi.RemoteException {
+ org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[0].getName());
+ _operationClient.getOptions().setAction("urn:main");
+ _operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);
+
+ addPropertyToOperationClient(_operationClient,
+ org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR,
+ "&");
+
+ org.apache.axiom.soap.SOAPEnvelope env = null;
+ org.apache.axis2.context.MessageContext _messageContext = new org.apache.axis2.context.MessageContext();
+
+ //Style is Doc.
+ env = toEnvelope(getFactory(_operationClient.getOptions()
+ .getSoapVersionURI()),
+ main,
+ optimizeContent(
+ new javax.xml.namespace.QName("http://test.zhguo", "main")));
+
+ //adding SOAP soap_headers
+ _serviceClient.addHeadersToEnvelope(env);
+ // create message context with that soap envelope
+ _messageContext.setEnvelope(env);
+
+ // add the message contxt to the operation client
+ _operationClient.addMessageContext(_messageContext);
+
+ _operationClient.execute(true);
+
+ return;
+ }
+
+ /**
+ * Auto generated method signature
+ * @see zhguo.test.SimpleHandler#cmdCOGExecute
+ * @param cmdCOGExecute
+ */
+ public zhguo.test.SimpleHandlerStub.CmdCOGExecuteResponse cmdCOGExecute(
+ zhguo.test.SimpleHandlerStub.CmdCOGExecute cmdCOGExecute)
+ throws java.rmi.RemoteException {
+ try {
+ org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[1].getName());
+ _operationClient.getOptions().setAction("urn:cmdCOGExecute");
+ _operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);
+
+ addPropertyToOperationClient(_operationClient,
+ org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR,
+ "&");
+
+ // create a message context
+ org.apache.axis2.context.MessageContext _messageContext = new org.apache.axis2.context.MessageContext();
+
+ // create SOAP envelope with that payload
+ org.apache.axiom.soap.SOAPEnvelope env = null;
+
+ env = toEnvelope(getFactory(_operationClient.getOptions()
+ .getSoapVersionURI()),
+ cmdCOGExecute,
+ optimizeContent(
+ new javax.xml.namespace.QName("http://test.zhguo",
+ "cmdCOGExecute")));
+
+ //adding SOAP soap_headers
+ _serviceClient.addHeadersToEnvelope(env);
+ // set the message context with that soap envelope
+ _messageContext.setEnvelope(env);
+
+ // add the message contxt to the operation client
+ _operationClient.addMessageContext(_messageContext);
+
+ //execute the operation client
+ _operationClient.execute(true);
+
+ org.apache.axis2.context.MessageContext _returnMessageContext = _operationClient.getMessageContext(org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE);
+ org.apache.axiom.soap.SOAPEnvelope _returnEnv = _returnMessageContext.getEnvelope();
+
+ java.lang.Object object = fromOM(_returnEnv.getBody()
+ .getFirstElement(),
+ zhguo.test.SimpleHandlerStub.CmdCOGExecuteResponse.class,
+ getEnvelopeNamespaces(_returnEnv));
+ _messageContext.getTransportOut().getSender()
+ .cleanup(_messageContext);
+
+ return (zhguo.test.SimpleHandlerStub.CmdCOGExecuteResponse) object;
+ } catch (org.apache.axis2.AxisFault f) {
+ org.apache.axiom.om.OMElement faultElt = f.getDetail();
+
+ if (faultElt != null) {
+ if (faultExceptionNameMap.containsKey(faultElt.getQName())) {
+ //make the fault by reflection
+ try {
+ java.lang.String exceptionClassName = (java.lang.String) faultExceptionClassNameMap.get(faultElt.getQName());
+ java.lang.Class exceptionClass = java.lang.Class.forName(exceptionClassName);
+ java.lang.Exception ex = (java.lang.Exception) exceptionClass.newInstance();
+
+ //message class
+ java.lang.String messageClassName = (java.lang.String) faultMessageMap.get(faultElt.getQName());
+ java.lang.Class messageClass = java.lang.Class.forName(messageClassName);
+ java.lang.Object messageObject = fromOM(faultElt,
+ messageClass, null);
+ java.lang.reflect.Method m = exceptionClass.getMethod("setFaultMessage",
+ new java.lang.Class[] { messageClass });
+ m.invoke(ex, new java.lang.Object[] { messageObject });
+
+ throw new java.rmi.RemoteException(ex.getMessage(), ex);
+ } catch (java.lang.ClassCastException e) {
+ // we cannot intantiate the class - throw the original Axis fault
+ throw f;
+ } catch (java.lang.ClassNotFoundException e) {
+ // we cannot intantiate the class - throw the original Axis fault
+ throw f;
+ } catch (java.lang.NoSuchMethodException e) {
+ // we cannot intantiate the class - throw the original Axis fault
+ throw f;
+ } catch (java.lang.reflect.InvocationTargetException e) {
+ // we cannot intantiate the class - throw the original Axis fault
+ throw f;
+ } catch (java.lang.IllegalAccessException e) {
+ // we cannot intantiate the class - throw the original Axis fault
+ throw f;
+ } catch (java.lang.InstantiationException e) {
+ // we cannot intantiate the class - throw the original Axis fault
+ throw f;
+ }
+ } else {
+ throw f;
+ }
+ } else {
+ throw f;
+ }
+ }
+ }
+
+ /**
+ * Auto generated method signature
+ * @see zhguo.test.SimpleHandler#echo
+ * @param echo
+ */
+ public zhguo.test.SimpleHandlerStub.EchoResponse echo(
+ zhguo.test.SimpleHandlerStub.Echo echo) throws java.rmi.RemoteException {
+ try {
+ org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[2].getName());
+ _operationClient.getOptions().setAction("urn:echo");
+ _operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);
+
+ addPropertyToOperationClient(_operationClient,
+ org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR,
+ "&");
+
+ // create a message context
+ org.apache.axis2.context.MessageContext _messageContext = new org.apache.axis2.context.MessageContext();
+
+ // create SOAP envelope with that payload
+ org.apache.axiom.soap.SOAPEnvelope env = null;
+
+ env = toEnvelope(getFactory(_operationClient.getOptions()
+ .getSoapVersionURI()),
+ echo,
+ optimizeContent(
+ new javax.xml.namespace.QName("http://test.zhguo",
+ "echo")));
+
+ //adding SOAP soap_headers
+ _serviceClient.addHeadersToEnvelope(env);
+ // set the message context with that soap envelope
+ _messageContext.setEnvelope(env);
+
+ // add the message contxt to the operation client
+ _operationClient.addMessageContext(_messageContext);
+
+ //execute the operation client
+ _operationClient.execute(true);
+
+ org.apache.axis2.context.MessageContext _returnMessageContext = _operationClient.getMessageContext(org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE);
+ org.apache.axiom.soap.SOAPEnvelope _returnEnv = _returnMessageContext.getEnvelope();
+
+ java.lang.Object object = fromOM(_returnEnv.getBody()
+ .getFirstElement(),
+ zhguo.test.SimpleHandlerStub.EchoResponse.class,
+ getEnvelopeNamespaces(_returnEnv));
+ _messageContext.getTransportOut().getSender()
+ .cleanup(_messageContext);
+
+ return (zhguo.test.SimpleHandlerStub.EchoResponse) object;
+ } catch (org.apache.axis2.AxisFault f) {
+ org.apache.axiom.om.OMElement faultElt = f.getDetail();
+
+ if (faultElt != null) {
+ if (faultExceptionNameMap.containsKey(faultElt.getQName())) {
+ //make the fault by reflection
+ try {
+ java.lang.String exceptionClassName = (java.lang.String) faultExceptionClassNameMap.get(faultElt.getQName());
+ java.lang.Class exceptionClass = java.lang.Class.forName(exceptionClassName);
+ java.lang.Exception ex = (java.lang.Exception) exceptionClass.newInstance();
+
+ //message class
+ java.lang.String messageClassName = (java.lang.String) faultMessageMap.get(faultElt.getQName());
+ java.lang.Class messageClass = java.lang.Class.forName(messageClassName);
+ java.lang.Object messageObject = fromOM(faultElt,
+ messageClass, null);
+ java.lang.reflect.Method m = exceptionClass.getMethod("setFaultMessage",
+ new java.lang.Class[] { messageClass });
+ m.invoke(ex, new java.lang.Object[] { messageObject });
+
+ throw new java.rmi.RemoteException(ex.getMessage(), ex);
+ } catch (java.lang.ClassCastException e) {
+ // we cannot intantiate the class - throw the original Axis fault
+ throw f;
+ } catch (java.lang.ClassNotFoundException e) {
+ // we cannot intantiate the class - throw the original Axis fault
+ throw f;
+ } catch (java.lang.NoSuchMethodException e) {
+ // we cannot intantiate the class - throw the original Axis fault
+ throw f;
+ } catch (java.lang.reflect.InvocationTargetException e) {
+ // we cannot intantiate the class - throw the original Axis fault
+ throw f;
+ } catch (java.lang.IllegalAccessException e) {
+ // we cannot intantiate the class - throw the original Axis fault
+ throw f;
+ } catch (java.lang.InstantiationException e) {
+ // we cannot intantiate the class - throw the original Axis fault
+ throw f;
+ }
+ } else {
+ throw f;
+ }
+ } else {
+ throw f;
+ }
+ }
+ }
+
+ /**
+ * A utility method that copies the namepaces from the SOAPEnvelope
+ */
+ private java.util.Map getEnvelopeNamespaces(
+ org.apache.axiom.soap.SOAPEnvelope env) {
+ java.util.Map returnMap = new java.util.HashMap();
+ java.util.Iterator namespaceIterator = env.getAllDeclaredNamespaces();
+
+ while (namespaceIterator.hasNext()) {
+ org.apache.axiom.om.OMNamespace ns = (org.apache.axiom.om.OMNamespace) namespaceIterator.next();
+ returnMap.put(ns.getPrefix(), ns.getNamespaceURI());
+ }
+
+ return returnMap;
+ }
+
+ private boolean optimizeContent(javax.xml.namespace.QName opName) {
+ if (opNameArray == null) {
+ return false;
+ }
+
+ for (int i = 0; i < opNameArray.length; i++) {
+ if (opName.equals(opNameArray[i])) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ private org.apache.axiom.om.OMElement toOM(
+ zhguo.test.SimpleHandlerStub.CmdCOGExecute param,
+ boolean optimizeContent) throws org.apache.axis2.AxisFault {
+ try {
+ return param.getOMElement(zhguo.test.SimpleHandlerStub.CmdCOGExecute.MY_QNAME,
+ org.apache.axiom.om.OMAbstractFactory.getOMFactory());
+ } catch (org.apache.axis2.databinding.ADBException e) {
+ throw org.apache.axis2.AxisFault.makeFault(e);
+ }
+ }
+
+ private org.apache.axiom.om.OMElement toOM(
+ zhguo.test.SimpleHandlerStub.CmdCOGExecuteResponse param,
+ boolean optimizeContent) throws org.apache.axis2.AxisFault {
+ try {
+ return param.getOMElement(zhguo.test.SimpleHandlerStub.CmdCOGExecuteResponse.MY_QNAME,
+ org.apache.axiom.om.OMAbstractFactory.getOMFactory());
+ } catch (org.apache.axis2.databinding.ADBException e) {
+ throw org.apache.axis2.AxisFault.makeFault(e);
+ }
+ }
+
+ private org.apache.axiom.om.OMElement toOM(
+ zhguo.test.SimpleHandlerStub.Echo param, boolean optimizeContent)
+ throws org.apache.axis2.AxisFault {
+ try {
+ return param.getOMElement(zhguo.test.SimpleHandlerStub.Echo.MY_QNAME,
+ org.apache.axiom.om.OMAbstractFactory.getOMFactory());
+ } catch (org.apache.axis2.databinding.ADBException e) {
+ throw org.apache.axis2.AxisFault.makeFault(e);
+ }
+ }
+
+ private org.apache.axiom.om.OMElement toOM(
+ zhguo.test.SimpleHandlerStub.EchoResponse param, boolean optimizeContent)
+ throws org.apache.axis2.AxisFault {
+ try {
+ return param.getOMElement(zhguo.test.SimpleHandlerStub.EchoResponse.MY_QNAME,
+ org.apache.axiom.om.OMAbstractFactory.getOMFactory());
+ } catch (org.apache.axis2.databinding.ADBException e) {
+ throw org.apache.axis2.AxisFault.makeFault(e);
+ }
+ }
+
+ private org.apache.axiom.om.OMElement toOM(
+ zhguo.test.SimpleHandlerStub.Main param, boolean optimizeContent)
+ throws org.apache.axis2.AxisFault {
+ try {
+ return param.getOMElement(zhguo.test.SimpleHandlerStub.Main.MY_QNAME,
+ org.apache.axiom.om.OMAbstractFactory.getOMFactory());
+ } catch (org.apache.axis2.databinding.ADBException e) {
+ throw org.apache.axis2.AxisFault.makeFault(e);
+ }
+ }
+
+ private org.apache.axiom.soap.SOAPEnvelope toEnvelope(
+ org.apache.axiom.soap.SOAPFactory factory,
+ zhguo.test.SimpleHandlerStub.CmdCOGExecute param,
+ boolean optimizeContent) throws org.apache.axis2.AxisFault {
+ try {
+ org.apache.axiom.soap.SOAPEnvelope emptyEnvelope = factory.getDefaultEnvelope();
+ emptyEnvelope.getBody()
+ .addChild(param.getOMElement(
+ zhguo.test.SimpleHandlerStub.CmdCOGExecute.MY_QNAME, factory));
+
+ return emptyEnvelope;
+ } catch (org.apache.axis2.databinding.ADBException e) {
+ throw org.apache.axis2.AxisFault.makeFault(e);
+ }
+ }
+
+ /* methods to provide back word compatibility */
+ private org.apache.axiom.soap.SOAPEnvelope toEnvelope(
+ org.apache.axiom.soap.SOAPFactory factory,
+ zhguo.test.SimpleHandlerStub.Echo param, boolean optimizeContent)
+ throws org.apache.axis2.AxisFault {
+ try {
+ org.apache.axiom.soap.SOAPEnvelope emptyEnvelope = factory.getDefaultEnvelope();
+ emptyEnvelope.getBody()
+ .addChild(param.getOMElement(
+ zhguo.test.SimpleHandlerStub.Echo.MY_QNAME, factory));
+
+ return emptyEnvelope;
+ } catch (org.apache.axis2.databinding.ADBException e) {
+ throw org.apache.axis2.AxisFault.makeFault(e);
+ }
+ }
+
+ /* methods to provide back word compatibility */
+ private org.apache.axiom.soap.SOAPEnvelope toEnvelope(
+ org.apache.axiom.soap.SOAPFactory factory,
+ zhguo.test.SimpleHandlerStub.Main param, boolean optimizeContent)
+ throws org.apache.axis2.AxisFault {
+ try {
+ org.apache.axiom.soap.SOAPEnvelope emptyEnvelope = factory.getDefaultEnvelope();
+ emptyEnvelope.getBody()
+ .addChild(param.getOMElement(
+ zhguo.test.SimpleHandlerStub.Main.MY_QNAME, factory));
+
+ return emptyEnvelope;
+ } catch (org.apache.axis2.databinding.ADBException e) {
+ throw org.apache.axis2.AxisFault.makeFault(e);
+ }
+ }
+
+ /* methods to provide back word compatibility */
+
+ /**
+ * get the default envelope
+ */
+ private org.apache.axiom.soap.SOAPEnvelope toEnvelope(
+ org.apache.axiom.soap.SOAPFactory factory) {
+ return factory.getDefaultEnvelope();
+ }
+
+ private java.lang.Object fromOM(org.apache.axiom.om.OMElement param,
+ java.lang.Class type, java.util.Map extraNamespaces)
+ throws org.apache.axis2.AxisFault {
+ try {
+ if (zhguo.test.SimpleHandlerStub.CmdCOGExecute.class.equals(type)) {
+ return zhguo.test.SimpleHandlerStub.CmdCOGExecute.Factory.parse(param.getXMLStreamReaderWithoutCaching());
+ }
+
+ if (zhguo.test.SimpleHandlerStub.CmdCOGExecuteResponse.class.equals(
+ type)) {
+ return zhguo.test.SimpleHandlerStub.CmdCOGExecuteResponse.Factory.parse(param.getXMLStreamReaderWithoutCaching());
+ }
+
+ if (zhguo.test.SimpleHandlerStub.Echo.class.equals(type)) {
+ return zhguo.test.SimpleHandlerStub.Echo.Factory.parse(param.getXMLStreamReaderWithoutCaching());
+ }
+
+ if (zhguo.test.SimpleHandlerStub.EchoResponse.class.equals(type)) {
+ return zhguo.test.SimpleHandlerStub.EchoResponse.Factory.parse(param.getXMLStreamReaderWithoutCaching());
+ }
+
+ if (zhguo.test.SimpleHandlerStub.Main.class.equals(type)) {
+ return zhguo.test.SimpleHandlerStub.Main.Factory.parse(param.getXMLStreamReaderWithoutCaching());
+ }
+ } catch (java.lang.Exception e) {
+ throw org.apache.axis2.AxisFault.makeFault(e);
+ }
+
+ return null;
+ }
+
+ //http://localhost:8080/axis2/services/SimpleHandler
+ public static class ExtensionMapper {
+ public static java.lang.Object getTypeObject(
+ java.lang.String namespaceURI, java.lang.String typeName,
+ javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception {
+ throw new org.apache.axis2.databinding.ADBException(
+ "Unsupported type " + namespaceURI + " " + typeName);
+ }
+ }
+
+ public static class CmdCOGExecuteResponse implements org.apache.axis2.databinding.ADBBean {
+ public static final javax.xml.namespace.QName MY_QNAME = new javax.xml.namespace.QName("http://test.zhguo/xsd",
+ "cmdCOGExecuteResponse", "ns1");
+
+ /**
+ * field for _return
+ */
+ protected java.lang.String local_return;
+
+ /* This tracker boolean wil be used to detect whether the user called the set method
+ * for this attribute. It will be used to determine whether to include this field
+ * in the serialized XML
+ */
+ protected boolean local_returnTracker = false;
+
+ private static java.lang.String generatePrefix(
+ java.lang.String namespace) {
+ if (namespace.equals("http://test.zhguo/xsd")) {
+ return "ns1";
+ }
+
+ return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
+ }
+
+ /**
+ * Auto generated getter method
+ * @return java.lang.String
+ */
+ public java.lang.String get_return() {
+ return local_return;
+ }
+
+ /**
+ * Auto generated setter method
+ * @param param _return
+ */
+ public void set_return(java.lang.String param) {
+ if (param != null) {
+ //update the setting tracker
+ local_returnTracker = true;
+ } else {
+ local_returnTracker = true;
+ }
+
+ this.local_return = param;
+ }
+
+ /**
+ * isReaderMTOMAware
+ * @return true if the reader supports MTOM
+ */
+ public static boolean isReaderMTOMAware(
+ javax.xml.stream.XMLStreamReader reader) {
+ boolean isReaderMTOMAware = false;
+
+ try {
+ isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(
+ org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE));
+ } catch (java.lang.IllegalArgumentException e) {
+ isReaderMTOMAware = false;
+ }
+
+ return isReaderMTOMAware;
+ }
+
+ /**
+ *
+ * @param parentQName
+ * @param factory
+ * @return org.apache.axiom.om.OMElement
+ */
+ public org.apache.axiom.om.OMElement getOMElement(
+ final javax.xml.namespace.QName parentQName,
+ final org.apache.axiom.om.OMFactory factory)
+ throws org.apache.axis2.databinding.ADBException {
+ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,
+ MY_QNAME) {
+ public void serialize(
+ org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter)
+ throws javax.xml.stream.XMLStreamException {
+ CmdCOGExecuteResponse.this.serialize(MY_QNAME, factory,
+ xmlWriter);
+ }
+ };
+
+ return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl(MY_QNAME,
+ factory, dataSource);
+ }
+
+ public void serialize(final javax.xml.namespace.QName parentQName,
+ final org.apache.axiom.om.OMFactory factory,
+ org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter)
+ throws javax.xml.stream.XMLStreamException,
+ org.apache.axis2.databinding.ADBException {
+ java.lang.String prefix = null;
+ java.lang.String namespace = null;
+
+ prefix = parentQName.getPrefix();
+ namespace = parentQName.getNamespaceURI();
+
+ if (namespace != null) {
+ java.lang.String writerPrefix = xmlWriter.getPrefix(namespace);
+
+ if (writerPrefix != null) {
+ xmlWriter.writeStartElement(namespace,
+ parentQName.getLocalPart());
+ } else {
+ if (prefix == null) {
+ prefix = generatePrefix(namespace);
+ }
+
+ xmlWriter.writeStartElement(prefix,
+ parentQName.getLocalPart(), namespace);
+ xmlWriter.writeNamespace(prefix, namespace);
+ xmlWriter.setPrefix(prefix, namespace);
+ }
+ } else {
+ xmlWriter.writeStartElement(parentQName.getLocalPart());
+ }
+
+ if (local_returnTracker) {
+ namespace = "http://test.zhguo/xsd";
+
+ if (!namespace.equals("")) {
+ prefix = xmlWriter.getPrefix(namespace);
+
+ if (prefix == null) {
+ prefix = generatePrefix(namespace);
+
+ xmlWriter.writeStartElement(prefix, "return", namespace);
+ xmlWriter.writeNamespace(prefix, namespace);
+ xmlWriter.setPrefix(prefix, namespace);
+ } else {
+ xmlWriter.writeStartElement(namespace, "return");
+ }
+ } else {
+ xmlWriter.writeStartElement("return");
+ }
+
+ if (local_return == null) {
+ // write the nil attribute
+ writeAttribute("xsi",
+ "http://www.w3.org/2001/XMLSchema-instance", "nil",
+ "1", xmlWriter);
+ } else {
+ xmlWriter.writeCharacters(local_return);
+ }
+
+ xmlWriter.writeEndElement();
+ }
+
+ xmlWriter.writeEndElement();
+ }
+
+ /**
+ * Util method to write an attribute with the ns prefix
+ */
+ private void writeAttribute(java.lang.String prefix,
+ java.lang.String namespace, java.lang.String attName,
+ java.lang.String attValue,
+ javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws javax.xml.stream.XMLStreamException {
+ if (xmlWriter.getPrefix(namespace) == null) {
+ xmlWriter.writeNamespace(prefix, namespace);
+ xmlWriter.setPrefix(prefix, namespace);
+ }
+
+ xmlWriter.writeAttribute(namespace, attName, attValue);
+ }
+
+ /**
+ * Util method to write an attribute without the ns prefix
+ */
+ private void writeAttribute(java.lang.String namespace,
+ java.lang.String attName, java.lang.String attValue,
+ javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws javax.xml.stream.XMLStreamException {
+ if (namespace.equals("")) {
+ xmlWriter.writeAttribute(attName, attValue);
+ } else {
+ registerPrefix(xmlWriter, namespace);
+ xmlWriter.writeAttribute(namespace, attName, attValue);
+ }
+ }
+
+ /**
+ * Util method to write an attribute without the ns prefix
+ */
+ private void writeQNameAttribute(java.lang.String namespace,
+ java.lang.String attName, javax.xml.namespace.QName qname,
+ javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws javax.xml.stream.XMLStreamException {
+ java.lang.String attributeNamespace = qname.getNamespaceURI();
+ java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace);
+
+ if (attributePrefix == null) {
+ attributePrefix = registerPrefix(xmlWriter, attributeNamespace);
+ }
+
+ java.lang.String attributeValue;
+
+ if (attributePrefix.trim().length() > 0) {
+ attributeValue = attributePrefix + ":" + qname.getLocalPart();
+ } else {
+ attributeValue = qname.getLocalPart();
+ }
+
+ if (namespace.equals("")) {
+ xmlWriter.writeAttribute(attName, attributeValue);
+ } else {
+ registerPrefix(xmlWriter, namespace);
+ xmlWriter.writeAttribute(namespace, attName, attributeValue);
+ }
+ }
+
+ /**
+ * method to handle Qnames
+ */
+ private void writeQName(javax.xml.namespace.QName qname,
+ javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws javax.xml.stream.XMLStreamException {
+ java.lang.String namespaceURI = qname.getNamespaceURI();
+
+ if (namespaceURI != null) {
+ java.lang.String prefix = xmlWriter.getPrefix(namespaceURI);
+
+ if (prefix == null) {
+ prefix = generatePrefix(namespaceURI);
+ xmlWriter.writeNamespace(prefix, namespaceURI);
+ xmlWriter.setPrefix(prefix, namespaceURI);
+ }
+
+ if (prefix.trim().length() > 0) {
+ xmlWriter.writeCharacters(prefix + ":" +
+ org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
+ qname));
+ } else {
+ // i.e this is the default namespace
+ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
+ qname));
+ }
+ } else {
+ xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
+ qname));
+ }
+ }
+
+ private void writeQNames(javax.xml.namespace.QName[] qnames,
+ javax.xml.stream.XMLStreamWriter xmlWriter)
+ throws javax.xml.stream.XMLStreamException {
+ if (qnames != null) {
+ // we have to store this data until last moment since it is not possible to write any
+ // namespace data after writing the charactor data
+ java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer();
+ java.lang.String namespaceURI = null;
+ java.lang.String prefix = null;
+
+ for (int i = 0; i < qnames.length; i++) {
+ if (i > 0) {
+ stringToWrite.append(" ");
+ }
+
+ namespaceURI = qnames[i].getNamespaceURI();
+
+ if (namespaceURI != null) {
+ prefix = xmlWriter.getPrefix(namespaceURI);
+
+ if ((prefix == null) || (prefix.length() == 0)) {
+ prefix = generatePrefix(namespaceURI);
+ xmlWriter.writeNamespace(prefix, namespaceURI);
+ xmlWriter.setPrefix(prefix, namespaceURI);
+ }
+
+ if (prefix.trim().length() > 0) {
+ stringToWrite.append(prefix).append(":")
+ .append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
+ qnames[i]));
+ } else {
+ stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
+ qnames[i]));
+ }
+ } else {
+ stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
+ qnames[i]));
+ }
+ }
+
+ xmlWriter.writeCharacters(stringToWrite.toString());
+ }
+ }
+
+ /**
+ * Register a namespace prefix
+ */
+ private java.lang.String registerPrefix(
+ javax.xml.stream.XMLStreamWriter xmlWriter,
+ java.lang.String namespace)
+ throws javax.xml.stream.XMLStreamException {
+ java.lang.String prefix = xmlWriter.getPrefix(namespace);
+
+ if (prefix == null) {
+ prefix = generatePrefix(namespace);
+
+ while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) {
+ prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
+ }
+
+ xmlWriter.writeNamespace(prefix, namespace);
+ xmlWriter.setPrefix(prefix, namespace);
+ }
+
+ return prefix;
+ }
+
+ /**
+ * databinding method to get an XML representation of this object
+ *
+ */
+ public javax.xml.stream.XMLStreamReader getPullParser(
+ javax.xml.namespace.QName qName)
+ throws org.apache.axis2.databinding.ADBException {
+ java.util.ArrayList elementList = new java.util.ArrayList();
+ java.util.ArrayList attribList = new java.util.ArrayList();
+
+ if (local_returnTracker) {
+ elementList.add(new javax.xml.namespace.QName(
+ "http://test.zhguo/xsd", "return"));
+
+ elementList.add((local_return == null) ? null
+ : org.apache.axis2.da...
[truncated message content] |
|
From: <fug...@us...> - 2007-11-02 18:05:54
|
Revision: 1826
http://cogkit.svn.sourceforge.net/cogkit/?rev=1826&view=rev
Author: fugangwang
Date: 2007-11-02 11:05:53 -0700 (Fri, 02 Nov 2007)
Log Message:
-----------
put the example files to the newly arranged directory structure
Added Paths:
-----------
trunk/cyberaide/src/
Removed Paths:
-------------
trunk/cyberaide/src/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ha...@us...> - 2007-11-02 18:01:31
|
Revision: 1825
http://cogkit.svn.sourceforge.net/cogkit/?rev=1825&view=rev
Author: hategan
Date: 2007-11-02 11:01:29 -0700 (Fri, 02 Nov 2007)
Log Message:
-----------
silly things would happen if the tree name had directories in it
Modified Paths:
--------------
trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/nodes/restartLog/RestartLog.java
Modified: trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/nodes/restartLog/RestartLog.java
===================================================================
--- trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/nodes/restartLog/RestartLog.java 2007-11-02 17:59:03 UTC (rev 1824)
+++ trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/nodes/restartLog/RestartLog.java 2007-11-02 18:01:29 UTC (rev 1825)
@@ -110,7 +110,7 @@
protected void create(VariableStack stack, String name) throws ExecutionException {
FlushableLockedFileWriter logffw = null;
if (name == null) {
- name = stack.getExecutionContext().getTree().getName();
+ name = new File(stack.getExecutionContext().getTree().getName()).getName();
}
for (int i = 0; i < Integer.MAX_VALUE; i++) {
String index = "." + String.valueOf(i);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ha...@us...> - 2007-11-02 17:59:16
|
Revision: 1824
http://cogkit.svn.sourceforge.net/cogkit/?rev=1824&view=rev
Author: hategan
Date: 2007-11-02 10:59:03 -0700 (Fri, 02 Nov 2007)
Log Message:
-----------
this was sitting uncommitted
Modified Paths:
--------------
trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/service/Client.java
Modified: trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/service/Client.java
===================================================================
--- trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/service/Client.java 2007-11-02 17:58:50 UTC (rev 1823)
+++ trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/service/Client.java 2007-11-02 17:59:03 UTC (rev 1824)
@@ -120,7 +120,7 @@
HostAuthorization hostAuthz = new HostAuthorization("host");
Authorization authz = new FallbackAuthorization(new Authorization[] { hostAuthz,
- new SelfAuthorization() });
+ SelfAuthorization.getInstance() });
GSSCredential cred = sc.getCredential();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fug...@us...> - 2007-11-02 17:58:51
|
Revision: 1823
http://cogkit.svn.sourceforge.net/cogkit/?rev=1823&view=rev
Author: fugangwang
Date: 2007-11-02 10:58:50 -0700 (Fri, 02 Nov 2007)
Log Message:
-----------
put the example files to the newly arranged directory structure
Removed Paths:
-------------
trunk/cyberaide/src/jaxws/Makefile
trunk/cyberaide/src/jaxws/README.txt
Deleted: trunk/cyberaide/src/jaxws/Makefile
===================================================================
--- trunk/cyberaide/src/jaxws/Makefile 2007-11-02 17:52:09 UTC (rev 1822)
+++ trunk/cyberaide/src/jaxws/Makefile 2007-11-02 17:58:50 UTC (rev 1823)
@@ -1,43 +0,0 @@
-help:
-
- @echo
- @echo "Ussage"
- @echo
- @echo " make compile - compiles all the source code"
- @echo " make service - generates the web service"
- @echo " make start - starts the Web Service"
- @echo " make wsdl - display in mozilla the wsdl file"
- @echo
- @echo "NOT YET IMPLEMENTED:"
- @echo " make stop - stops the Web Service"
- @echo " make stopall - stops all java processes"
- @echo " make run - runs a client process"
-
-all: compile service run
- echo done
-
-compile:
-# cd hello; javac CircleFunctionsClient.java
- cd hello; javac CircleFunctions.java
-
-service:
- wsgen -cp . hello.CircleFunctions
-
-start:
- java hello.CircleFunctions
-
-wsdl:
- mozilla http://localhost:8080/jaxws/circlefunctions?WSDL
-stop:
-
-stopall:
- #write shell script that stops all java processes
-
-run:
-
-ls:
- echo lists all java processes
- ps -aux | fgrep java
-
-clean:
- rm -f *.class */*.class */*/*.class
Deleted: trunk/cyberaide/src/jaxws/README.txt
===================================================================
--- trunk/cyberaide/src/jaxws/README.txt 2007-11-02 17:52:09 UTC (rev 1822)
+++ trunk/cyberaide/src/jaxws/README.txt 2007-11-02 17:58:50 UTC (rev 1823)
@@ -1 +0,0 @@
-see ../../README.txt
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fug...@us...> - 2007-11-02 17:52:13
|
Revision: 1822
http://cogkit.svn.sourceforge.net/cogkit/?rev=1822&view=rev
Author: fugangwang
Date: 2007-11-02 10:52:09 -0700 (Fri, 02 Nov 2007)
Log Message:
-----------
put the example files to the newly arranged directory structure
Removed Paths:
-------------
trunk/cyberaide/src/jaxws/test/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fug...@us...> - 2007-11-02 17:00:33
|
Revision: 1821
http://cogkit.svn.sourceforge.net/cogkit/?rev=1821&view=rev
Author: fugangwang
Date: 2007-11-02 10:00:27 -0700 (Fri, 02 Nov 2007)
Log Message:
-----------
add build directory to store build files
Added Paths:
-----------
trunk/cyberaide/build/
trunk/cyberaide/build/wsdl/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fug...@us...> - 2007-11-02 16:58:52
|
Revision: 1820
http://cogkit.svn.sourceforge.net/cogkit/?rev=1820&view=rev
Author: fugangwang
Date: 2007-11-02 09:58:51 -0700 (Fri, 02 Nov 2007)
Log Message:
-----------
change directory structure, package name, and Makefile so that the generated files are stored into a separate build directory
Added Paths:
-----------
trunk/cyberaide/src/jaxws/test/
trunk/cyberaide/src/jaxws/test/README.txt
Removed Paths:
-------------
trunk/cyberaide/src/jaxws/testCircleService/
trunk/cyberaide/src/jaxws/testMultipleService/
Added: trunk/cyberaide/src/jaxws/test/README.txt
===================================================================
--- trunk/cyberaide/src/jaxws/test/README.txt (rev 0)
+++ trunk/cyberaide/src/jaxws/test/README.txt 2007-11-02 16:58:51 UTC (rev 1820)
@@ -0,0 +1,3 @@
+./testCircleService/ contains a test example to deploy a web service using jaxws and consume it from a java client program
+./testMultipleService/ contains a test example to deploy two web services at one host using jaxws and consume the two services from a single java client program
+The build class files and stubs generated by wsgen and wsimport are stored in /cyberaide/build/org/cogkit/cyberaide/jaxws/test; the generated wsdl files are stored in /cyberaide/build/wsdl
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fug...@us...> - 2007-11-02 03:28:08
|
Revision: 1819
http://cogkit.svn.sourceforge.net/cogkit/?rev=1819&view=rev
Author: fugangwang
Date: 2007-11-01 20:28:05 -0700 (Thu, 01 Nov 2007)
Log Message:
-----------
add an test example which provides two different services on one host. A java client invokes the two services in one program.
Added Paths:
-----------
trunk/cyberaide/src/jaxws/testMultipleService/
trunk/cyberaide/src/jaxws/testMultipleService/CircleFunctions.java
trunk/cyberaide/src/jaxws/testMultipleService/Makefile
trunk/cyberaide/src/jaxws/testMultipleService/SquareFunctions.java
trunk/cyberaide/src/jaxws/testMultipleService/TestMultipleService.java
trunk/cyberaide/src/jaxws/testMultipleService/stop.sh
Added: trunk/cyberaide/src/jaxws/testMultipleService/CircleFunctions.java
===================================================================
--- trunk/cyberaide/src/jaxws/testMultipleService/CircleFunctions.java (rev 0)
+++ trunk/cyberaide/src/jaxws/testMultipleService/CircleFunctions.java 2007-11-02 03:28:05 UTC (rev 1819)
@@ -0,0 +1,46 @@
+/*
+ * CircleFunctions.java
+ *
+ * @version:
+ * $Id v1.0$
+ *
+ * @author:
+ * Fugang Wang
+ *
+ * Revisions:
+ * 10/28/2007 Initial version
+ * 11/01/2007 modify package name
+ * modify package name to use in multiple service deployment
+ */
+package testjaxws.service.circle;
+
+import javax.jws.WebService;
+import javax.xml.ws.Endpoint;
+
+@WebService
+public class CircleFunctions {
+
+ /*
+ * return area of a circle
+ */
+ public double getArea(double r) {
+ return java.lang.Math.PI * (r * r);
+ }
+
+ /*
+ * return circumference of a circle
+ */
+ public double getCircumference(double r) {
+ return 2 * java.lang.Math.PI * r;
+ }
+
+ /*
+ * publish the service
+ */
+ public static void main(String[] args) {
+
+ Endpoint.publish(
+ "http://localhost:8080/jaxws/circlefunctions",
+ new CircleFunctions());
+ }
+}
Added: trunk/cyberaide/src/jaxws/testMultipleService/Makefile
===================================================================
--- trunk/cyberaide/src/jaxws/testMultipleService/Makefile (rev 0)
+++ trunk/cyberaide/src/jaxws/testMultipleService/Makefile 2007-11-02 03:28:05 UTC (rev 1819)
@@ -0,0 +1,32 @@
+all: compile service client stop
+ @echo done
+
+init:
+ mkdir -p testjaxws
+
+compile: init
+ javac -d . CircleFunctions.java
+ javac -d . SquareFunctions.java
+
+service:
+ @echo "Starting the two services..."
+ wsgen -cp . -r testjaxws -wsdl testjaxws.service.circle.CircleFunctions
+ java testjaxws.service.circle.CircleFunctions &
+ sleep 2
+ wsgen -cp . -r testjaxws -wsdl testjaxws.service.square.SquareFunctions
+ java testjaxws.service.square.SquareFunctions &
+ sleep 2
+
+client:
+ @echo "Generating and running client..."
+ wsimport -keep -p testjaxws.clientstub.circle http://localhost:8080/jaxws/circlefunctions?WSDL
+ wsimport -keep -p testjaxws.clientstub.square http://localhost:8180/jaxws/squarefunctions?WSDL
+ javac -d . TestMultipleService.java
+ java testjaxws.client.TestMultipleService
+
+stop:
+ @echo "Stopping services..."
+ sh stop.sh
+
+clean:
+ rm -fr testjaxws
Added: trunk/cyberaide/src/jaxws/testMultipleService/SquareFunctions.java
===================================================================
--- trunk/cyberaide/src/jaxws/testMultipleService/SquareFunctions.java (rev 0)
+++ trunk/cyberaide/src/jaxws/testMultipleService/SquareFunctions.java 2007-11-02 03:28:05 UTC (rev 1819)
@@ -0,0 +1,45 @@
+/*
+ * SquareFunctions.java
+ *
+ * @version:
+ * $Id v1.0$
+ *
+ * @author:
+ * Fugang Wang
+ *
+ * Revisions:
+ * 11/01/2007 Initial version
+ *
+ */
+package testjaxws.service.square;
+
+import javax.jws.WebService;
+import javax.xml.ws.Endpoint;
+
+@WebService
+public class SquareFunctions {
+
+ /*
+ * return area of a Square
+ */
+ public double getArea(double s) {
+ return (s * s);
+ }
+
+ /*
+ * return circumference of a Square
+ */
+ public double getCircumference(double s) {
+ return 4 * s;
+ }
+
+ /*
+ * publish the service
+ */
+ public static void main(String[] args) {
+
+ Endpoint.publish(
+ "http://localhost:8180/jaxws/squarefunctions",
+ new SquareFunctions());
+ }
+}
Added: trunk/cyberaide/src/jaxws/testMultipleService/TestMultipleService.java
===================================================================
--- trunk/cyberaide/src/jaxws/testMultipleService/TestMultipleService.java (rev 0)
+++ trunk/cyberaide/src/jaxws/testMultipleService/TestMultipleService.java 2007-11-02 03:28:05 UTC (rev 1819)
@@ -0,0 +1,80 @@
+/*
+ * TestMultipleService.java
+ *
+ * @version:
+ * $Id v1.0$
+ *
+ * @author:
+ * Fugang Wang
+ *
+ * Revisions:
+ * 11/01/2007 Initial version
+ *
+ */
+package testjaxws.client;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+import javax.xml.ws.WebEndpoint;
+import javax.xml.ws.WebServiceRef;
+//import javax.jws.WebService;
+import testjaxws.clientstub.circle.CircleFunctionsService;
+import testjaxws.clientstub.square.SquareFunctionsService;
+
+//@WebServiceRef(wsdlLocation = "http://localhost:8080/jaxws/circlefunctions?WSDL")
+
+public class TestMultipleService {
+ static CircleFunctionsService service1 = new CircleFunctionsService();
+ static SquareFunctionsService service2 = new SquareFunctionsService();
+
+ public static void main(String[] args) {
+ try {
+ TestMultipleService client = new TestMultipleService();
+ client.doTest(args);
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void doTest(String[] args) {
+ try {
+ System.out.println("------------------from Client running------------------");
+ System.out.println("----------try to call the first service----------");
+ System.out.println("Retrieving the port from the following service:\n\t " + service1);
+ testjaxws.clientstub.circle.CircleFunctions port1 = service1.getCircleFunctionsPort();
+ double radius,area,circumference;
+
+ System.out.println("Invoking the getArea operation on the port...");
+ System.out.print("Response from server:\n\tThe area of a circle with radius 10:");
+ radius = 10;
+ area = port1.getArea(radius);
+ System.out.println( area );
+
+ System.out.println("Invoking the getCircumference operation on the port...");
+ System.out.print("Response from server:\n\tThe circumference of a circle with radius 10:");
+ circumference = port1.getCircumference(radius);
+ System.out.println( circumference );
+
+ System.out.println("----------try to get to another service----------");
+ System.out.println("Retrieving the port from the following service:\n\t " + service2);
+ testjaxws.clientstub.square.SquareFunctions port2 = service2.getSquareFunctionsPort();
+ double side = 10;
+
+ System.out.println("Invoking the getArea operation on the port...");
+ System.out.print("Response from server:\n\tThe area of a square with side 10:");
+ area = port2.getArea(radius);
+ System.out.println( area );
+
+ System.out.println("Invoking the getCircumference operation on the port...");
+ System.out.print("Response from server:\n\tThe circumference of a square with side 10:");
+ circumference = port2.getCircumference(radius);
+ System.out.println( circumference );
+
+
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+ }
+}
Added: trunk/cyberaide/src/jaxws/testMultipleService/stop.sh
===================================================================
--- trunk/cyberaide/src/jaxws/testMultipleService/stop.sh (rev 0)
+++ trunk/cyberaide/src/jaxws/testMultipleService/stop.sh 2007-11-02 03:28:05 UTC (rev 1819)
@@ -0,0 +1 @@
+kill -9 `ps -a|grep java|awk '{print $1}'`
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|