Subversion Repositories XServices

Compare Revisions

Problem with comparison.

Ignore whitespace Rev HEAD → Rev 64

/xservices/trunk/src/java/net/brutex/xservices/util/XServicesDocumentation.java
0,0 → 1,65
/*
* Copyright 2011 Brian Rosenberger (Brutex Network)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
 
package net.brutex.xservices.util;
 
/**
* Holds static documentation.
*
*
* @author Brian Rosenberger, bru@brutex.de
*/
public class XServicesDocumentation {
 
public static final String BRUTEX_COPYRIGHT = "" +
"/*\n" +
"* Copyright 2010 Brian Rosenberger (Brutex Network)\n" +
"*\n" +
"* Licensed under the Apache License, Version 2.0 (the \"License\")\n" +
"* you may not use this file except in compliance with the License.\n" +
"* You may obtain a copy of the License at\n" +
"*\n" +
"* http://www.apache.org/licenses/LICENSE-2.0\n" +
"*\n" +
"* Unless required by applicable law or agreed to in writing, software\n" +
"* distributed under the License is distributed on an \"AS IS\" BASIS,\n" +
"* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n" +
"* See the License for the specific language governing permissions and\n" +
"* limitations under the License.\n" +
"*/";
 
 
public static final String SERVICE_OPERATION_DOWNLOADFILE = "Download a file from the maschine where the service is running in order " +
"to process it with the client. The file is either downloaded as a MTOM attachment or " +
"as inline base64 encoded block. Keep in mind that unless you are using MTOM, a lot of " +
"java heap memory is used.";
public static final String SERVICE_OPERATION_UPLOADFILE = "Send a file from client to web service server using either " +
"MTOM attachment or base64 inline attachment.";
public static final String SERVICE_OPERATION_COPY = "Copies a fileset locally on the server.";
public static final String SERVICE_OPERATION_COPYFILE = "Copies a single file locally on the server";
public static final String SERVICE_OPERATION_LOADRESOURCE = "Load the content of a resource";
public static final String SERVICE_OPERATION_LOADRESOURCEFROMARCHIVE = "Load the content of a resource";
public static final String SERVICE_OPERATION_ECHOTOFILE = "Write or append a string to a file";
private XServicesDocumentation() {};
}
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/xservices/trunk/src/java/net/brutex/xservices/util/BrutexNamespaces.java
0,0 → 1,54
/*
* Copyright 2010 Brian Rosenberger (Brutex Network)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
 
package net.brutex.xservices.util;
 
/**
* Holds static namespace information.
*
*
* @author Brian Rosenberger, bru@brutex.de
*/
public class BrutexNamespaces {
 
/**
* Brutex Network XServices web service name space declaration
*/
public static final String WS_XSERVICES = "http://ws.xservices.brutex.net";
/**
* Copyright and license agreement statement.
*/
public static final String BRUTEX_COPYRIGHT = "" +
"/*\n" +
"* Copyright 2010 Brian Rosenberger (Brutex Network)\n" +
"*\n" +
"* Licensed under the Apache License, Version 2.0 (the \"License\")\n" +
"* you may not use this file except in compliance with the License.\n" +
"* You may obtain a copy of the License at\n" +
"*\n" +
"* http://www.apache.org/licenses/LICENSE-2.0\n" +
"*\n" +
"* Unless required by applicable law or agreed to in writing, software\n" +
"* distributed under the License is distributed on an \"AS IS\" BASIS,\n" +
"* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n" +
"* See the License for the specific language governing permissions and\n" +
"* limitations under the License.\n" +
"*/";
 
 
private BrutexNamespaces() {};
}
/xservices/trunk/src/java/net/brutex/xservices/util/RunTask.java
0,0 → 1,101
/*
* Copyright 2010 Brian Rosenberger (Brutex Network)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.brutex.xservices.util;
 
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.util.HashMap;
import java.util.Map;
import net.brutex.xservices.types.AntProperty;
import net.brutex.xservices.types.ReturnCode;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Target;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.listener.TimestampedLogger;
import org.apache.tools.ant.taskdefs.Echo;
 
/**
*
* @author Brian Rosenberger, bru@brutex.de
*/
public class RunTask {
 
Project antproject;
Target anttarget;
Task anttask;
ByteArrayOutputStream myout = new ByteArrayOutputStream();
ByteArrayOutputStream myerr = new ByteArrayOutputStream();
PrintStream out = new PrintStream(myout);
PrintStream err = new PrintStream(myerr);
TimestampedLogger log = null;
 
public RunTask(Task anttask) {
 
antproject = new Project();
antproject.init();
antproject.setBasedir(System.getProperty("java.io.tmpdir"));
log = new TimestampedLogger();
log.setOutputPrintStream(out);
log.setErrorPrintStream(err);
log.setMessageOutputLevel(Echo.EchoLevel.WARN.getLevel());
 
antproject.addBuildListener(log);
 
anttarget = new Target();
anttarget.setName("XBridgeNGDynamicTarget");
anttarget.setProject(antproject);
antproject.addTarget(anttarget);
 
this.anttask = anttask;
prepareTask();
}
 
private void prepareTask()
throws BuildException {
anttask.init();
anttask.setProject(antproject);
anttask.setOwningTarget(anttarget);
anttarget.addTask(anttask);
antproject.addOrReplaceTarget(anttarget);
}
 
public ReturnCode postTask() {
int returnCode = 0;
Map<String, String> origMap = new HashMap<String, String>();
Map<String, String> newMap = null;
origMap.putAll(antproject.getProperties());
try {
antproject.executeTarget(anttarget.getName());
} catch (BuildException ex) {
err.print(ex.getMessage());
returnCode = 1;
}
newMap = antproject.getProperties();
newMap.putAll(antproject.getUserProperties());
for (Map.Entry<String, String> e : origMap.entrySet()) {
newMap.remove(e.getKey());
}
 
//anttask.execute();
return new ReturnCode(returnCode,
myout.toString(),
myerr.toString(),
AntProperty.createAntPropertyList(newMap));
 
}
}
/xservices/trunk/src/java/net/brutex/xservices/util/UnRarTask.java
0,0 → 1,74
/*
* Copyright 2010 Brian Rosenberger (Brutex Network)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
 
package net.brutex.xservices.util;
 
import de.innosystec.unrar.Archive;
import de.innosystec.unrar.exception.RarException;
import de.innosystec.unrar.rarfile.FileHeader;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.List;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Task;
 
/**
*
* @author Brian Rosenberger, bru@brutex.de
*/
public class UnRarTask extends Task {
 
private File dst = null;
private File src = null;
 
public File getDst() {
return dst;
}
 
public void setDst(File dst) {
this.dst = dst;
}
 
public File getSrc() {
return src;
}
 
public void setSrc(File src) {
this.src = src;
}
 
 
@Override
public void execute() {
if(src==null ) throw new BuildException("Please supply a source archive file.");
if(!src.exists()) throw new BuildException("Archive '"+src.getName()+"' does not exist.");
 
try {
if(dst==null) dst = new File(src.getParent());
Archive ar = new Archive(src);
List<FileHeader> list = ar.getFileHeaders();
for(FileHeader h : list) {
ar.extractFile(h, new FileOutputStream(new File(dst.getAbsolutePath()+"/"+h.getFileNameString())));
}
} catch (RarException ex) {
throw new BuildException(ex.getMessage(), ex);
} catch (IOException ex) {
throw new BuildException(ex.getMessage(), ex);
}
}
 
}