git-svn-id: https://brutex.net/svn/xservices/trunk@109 e7e49efb-446e-492e-b9ec-fcafc1997a86
parent
6f7e794711
commit
5f3b81ebfd
|
@ -1,69 +1,47 @@
|
||||||
/*
|
|
||||||
* Copyright 2012 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.ws.rs;
|
package net.brutex.xservices.ws.rs;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.ws.rs.DefaultValue;
|
import javax.ws.rs.DefaultValue;
|
||||||
import javax.ws.rs.GET;
|
import javax.ws.rs.GET;
|
||||||
import javax.ws.rs.Path;
|
import javax.ws.rs.Path;
|
||||||
import javax.ws.rs.PathParam;
|
|
||||||
import javax.ws.rs.Produces;
|
import javax.ws.rs.Produces;
|
||||||
import javax.ws.rs.QueryParam;
|
import javax.ws.rs.QueryParam;
|
||||||
import javax.ws.rs.core.Context;
|
import javax.ws.rs.core.Context;
|
||||||
import javax.ws.rs.core.HttpHeaders;
|
import javax.ws.rs.core.HttpHeaders;
|
||||||
import javax.ws.rs.core.MediaType;
|
|
||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
|
|
||||||
import net.brutex.xservices.types.FileInfoType;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Path("/CVSService/")
|
@Path("/CVSService/")
|
||||||
@Produces ({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
|
@Produces({"application/xml", "application/json"})
|
||||||
public interface CVSInfo {
|
public abstract interface CVSInfo
|
||||||
|
{
|
||||||
|
public static final String WS_OPERATION_GETREPOSITORYFILES = "getRepositoryFiles";
|
||||||
|
public static final String WS_OPERATION_GETMODULES = "getModules";
|
||||||
|
public static final String WS_OPERATION_GETTAGS = "getTags";
|
||||||
|
public static final String WS_OPERATION_GETFILECONTENT = "getFileContent";
|
||||||
|
public static final String WS_OPERATION_SEARCHFILECONTENT = "searchFileContent";
|
||||||
|
|
||||||
/**
|
@GET
|
||||||
* @param module
|
@Path("getRepositoryFiles")
|
||||||
* @param withDir
|
public abstract Response getRepositoryFiles(@Context HttpHeaders paramHttpHeaders, @QueryParam("config") File paramFile, @QueryParam("modules") @DefaultValue("") String paramString, @QueryParam("recursive") @DefaultValue("false") boolean paramBoolean1, @QueryParam("showRevisions") @DefaultValue("false") boolean paramBoolean2, @QueryParam("forceNoCache") @DefaultValue("false") boolean paramBoolean3);
|
||||||
* @param withFiles
|
|
||||||
* @param depth
|
|
||||||
* @param search
|
|
||||||
* @param count
|
|
||||||
* @param page
|
|
||||||
* @return List of File
|
|
||||||
*/
|
|
||||||
@GET
|
|
||||||
@Path("getRepositoryFiles/")
|
|
||||||
public Response getRepositoryFiles(@Context HttpHeaders h,
|
|
||||||
@QueryParam("config") File f,
|
|
||||||
@QueryParam("modules") @DefaultValue("") String modules,
|
|
||||||
@QueryParam("showRevisions") @DefaultValue("false") boolean showRevisions,
|
|
||||||
@QueryParam("forceNoCache") @DefaultValue("false") boolean forceNoCache
|
|
||||||
);
|
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("getModules")
|
@Path("getModules")
|
||||||
public Response getModules(@Context HttpHeaders h,
|
public abstract Response getModules(@Context HttpHeaders paramHttpHeaders, @QueryParam("config") File paramFile, @QueryParam("forceNoCache") @DefaultValue("false") boolean paramBoolean);
|
||||||
@QueryParam("config") File f,
|
|
||||||
@QueryParam("forceNoCache") @DefaultValue("false") boolean forceNoCache);
|
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("getTags")
|
||||||
|
public abstract Response getTags(@Context HttpHeaders paramHttpHeaders, @QueryParam("config") File paramFile, @QueryParam("withFiles") @DefaultValue("false") boolean paramBoolean);
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("getFileContent")
|
||||||
|
public abstract Response getFileContent(@Context HttpHeaders paramHttpHeaders, @QueryParam("config") File paramFile, @QueryParam("file") String paramString, @QueryParam("forceNoCache") @DefaultValue("false") boolean paramBoolean);
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("searchFileContent")
|
||||||
|
public abstract Response searchFileContent(@Context HttpHeaders paramHttpHeaders, @QueryParam("config") File paramFile, @QueryParam("file_regexp") String paramString1, @QueryParam("content_regexp") String paramString2, @QueryParam("forceNoCache") @DefaultValue("false") boolean paramBoolean);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Location: C:\Users\brosenberger\Documents\My Box Files\XBridgeNG-download\XServices-20130131 - Kopie\WEB-INF\classes\net.zip
|
||||||
|
* Qualified Name: net.brutex.xservices.ws.rs.CVSInfo
|
||||||
|
* JD-Core Version: 0.6.2
|
||||||
|
*/
|
|
@ -1,14 +1,28 @@
|
||||||
package net.brutex.xservices.ws.rs;
|
package net.brutex.xservices.ws.rs;
|
||||||
|
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.io.FileReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.PrintStream;
|
||||||
|
import java.net.URI;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
|
|
||||||
import javax.ws.rs.core.GenericEntity;
|
|
||||||
import javax.ws.rs.core.HttpHeaders;
|
import javax.ws.rs.core.HttpHeaders;
|
||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
|
import javax.ws.rs.core.Response.ResponseBuilder;
|
||||||
|
import net.brutex.xservices.types.scm.AttributeType;
|
||||||
|
import net.brutex.xservices.types.scm.ItemListType;
|
||||||
|
import net.brutex.xservices.types.scm.ItemType;
|
||||||
|
import net.brutex.xservices.types.scm.ModuleListType;
|
||||||
|
import net.brutex.xservices.types.scm.ModuleType;
|
||||||
|
import net.brutex.xservices.types.scm.ObjectFactory;
|
||||||
|
import net.brutex.xservices.types.scm.RevisionType;
|
||||||
|
import net.brutex.xservices.types.scm.TagListType;
|
||||||
|
import net.brutex.xservices.types.scmfindings.FindingsListType;
|
||||||
|
import net.brutex.xservices.util.BasicCVSListener;
|
||||||
|
import net.brutex.xservices.util.CVSClient;
|
||||||
|
import net.brutex.xservices.util.CVSRoot;
|
||||||
import org.apache.commons.configuration.ConfigurationException;
|
import org.apache.commons.configuration.ConfigurationException;
|
||||||
import org.apache.jcs.JCS;
|
import org.apache.jcs.JCS;
|
||||||
import org.apache.jcs.access.exception.CacheException;
|
import org.apache.jcs.access.exception.CacheException;
|
||||||
|
@ -16,210 +30,348 @@ import org.apache.log4j.Logger;
|
||||||
import org.netbeans.lib.cvsclient.Client;
|
import org.netbeans.lib.cvsclient.Client;
|
||||||
import org.netbeans.lib.cvsclient.command.CommandAbortedException;
|
import org.netbeans.lib.cvsclient.command.CommandAbortedException;
|
||||||
import org.netbeans.lib.cvsclient.command.CommandException;
|
import org.netbeans.lib.cvsclient.command.CommandException;
|
||||||
|
import org.netbeans.lib.cvsclient.command.FileInfoContainer;
|
||||||
|
import org.netbeans.lib.cvsclient.command.PipedFileInformation;
|
||||||
import org.netbeans.lib.cvsclient.command.checkout.CheckoutCommand;
|
import org.netbeans.lib.cvsclient.command.checkout.CheckoutCommand;
|
||||||
import org.netbeans.lib.cvsclient.command.checkout.ModuleListInformation;
|
import org.netbeans.lib.cvsclient.command.checkout.ModuleListInformation;
|
||||||
import org.netbeans.lib.cvsclient.command.log.LogInformation;
|
import org.netbeans.lib.cvsclient.command.log.LogInformation;
|
||||||
|
import org.netbeans.lib.cvsclient.command.log.LogInformation.Revision;
|
||||||
import org.netbeans.lib.cvsclient.command.log.RlogCommand;
|
import org.netbeans.lib.cvsclient.command.log.RlogCommand;
|
||||||
import org.netbeans.lib.cvsclient.connection.AuthenticationException;
|
import org.netbeans.lib.cvsclient.connection.AuthenticationException;
|
||||||
|
import org.netbeans.lib.cvsclient.event.EventManager;
|
||||||
import org.netbeans.lib.cvsclient.event.FileInfoEvent;
|
import org.netbeans.lib.cvsclient.event.FileInfoEvent;
|
||||||
|
|
||||||
import net.brutex.xservices.types.scm.ModuleType;
|
|
||||||
import net.brutex.xservices.types.scm.FileType;
|
|
||||||
import net.brutex.xservices.types.scm.Revision;
|
|
||||||
import net.brutex.xservices.util.BasicCVSListener;
|
|
||||||
import net.brutex.xservices.util.CVSClient;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Brian Rosenberger
|
|
||||||
* @since 0.5.0-20120824
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class CVSInfoImpl implements CVSInfo {
|
public class CVSInfoImpl implements CVSInfo {
|
||||||
|
|
||||||
final Logger logger = Logger.getLogger(CVSInfoImpl.class);
|
final Logger logger = Logger.getLogger(CVSInfoImpl.class);
|
||||||
|
final ObjectFactory FACTORY = new ObjectFactory();
|
||||||
|
final ItemListType list = this.FACTORY.createItemListType();
|
||||||
|
|
||||||
public Response getRepositoryFiles(HttpHeaders h, File f, String modules,
|
public Response getRepositoryFiles(HttpHeaders h, File f, String modules,
|
||||||
boolean showRevisions,
|
boolean isRecursive, boolean showRevisions, boolean forceNoCache) {
|
||||||
boolean forceNoCache) {
|
|
||||||
|
|
||||||
final List<FileType> list = new ArrayList<FileType>();
|
|
||||||
|
|
||||||
String cachekey = "getFiles" + f.toURI().toString();
|
String cachekey = "getFiles" + f.toURI().toString();
|
||||||
logger.debug("forceNoCache="+forceNoCache);
|
this.logger.debug("forceNoCache=" + forceNoCache);
|
||||||
List<FileType> cacheresult = (List<FileType>) getCacheInstance().get(
|
ItemListType cacheresult = (ItemListType) getCacheInstance().get(
|
||||||
cachekey);
|
cachekey);
|
||||||
|
|
||||||
if (!forceNoCache && cacheresult != null) {
|
if ((!forceNoCache) && (cacheresult != null)) {
|
||||||
// Cache hit
|
return Response.ok(cacheresult).build();
|
||||||
list.addAll(cacheresult);
|
}
|
||||||
} else {
|
Client client;
|
||||||
// Cache miss
|
try {
|
||||||
try {
|
final CVSClient cvsclient = new CVSClient(f);
|
||||||
CVSClient cvsclient = new CVSClient(f);
|
client = cvsclient.client;
|
||||||
Client client = cvsclient.client;
|
|
||||||
|
|
||||||
client.getEventManager().addCVSListener(new BasicCVSListener() {
|
client.getEventManager().addCVSListener(new BasicCVSListener() {
|
||||||
@Override
|
public void fileInfoGenerated(FileInfoEvent arg0) {
|
||||||
public void fileInfoGenerated(FileInfoEvent arg0) {
|
LogInformation info = (LogInformation) arg0
|
||||||
LogInformation info = (LogInformation) arg0
|
.getInfoContainer();
|
||||||
.getInfoContainer();
|
String repoPath = cvsclient.client.getRepository();
|
||||||
FileType cvsfile = new FileType(info.getFile(), info
|
|
||||||
.getRepositoryFilename(), info.getDescription());
|
ItemType cvsfile = CVSInfoImpl.this.FACTORY
|
||||||
cvsfile.setHeadRevision(info.getHeadRevision());
|
.createItemType();
|
||||||
cvsfile.setBranch(info.getBranch());
|
cvsfile.setIsLeaf(true);
|
||||||
cvsfile.setTotalRevisions(info.getTotalRevisions());
|
cvsfile.setIsBinary(false);
|
||||||
for (LogInformation.Revision r : info.getRevisionList()) {
|
|
||||||
cvsfile.addRevision(new Revision(r.getNumber(), r
|
cvsfile.setFullname(info.getRepositoryFilename().substring(
|
||||||
.getMessage()));
|
repoPath.length() + 2,
|
||||||
}
|
info.getRepositoryFilename().length() - 2));
|
||||||
list.add(cvsfile);
|
|
||||||
|
cvsfile.setRemotename(info.getRepositoryFilename());
|
||||||
|
cvsfile.setRemotefullname(info.getRepositoryFilename());
|
||||||
|
RevisionType revision = CVSInfoImpl.this.FACTORY
|
||||||
|
.createRevisionType();
|
||||||
|
revision.setRevision(info.getHeadRevision());
|
||||||
|
revision.setComment(info.getDescription());
|
||||||
|
cvsfile.setTipRevision(revision);
|
||||||
|
|
||||||
|
for (LogInformation.Revision r : info.getRevisionList()) {
|
||||||
|
revision = CVSInfoImpl.this.FACTORY
|
||||||
|
.createRevisionType();
|
||||||
|
revision.setRevision(r.getNumber());
|
||||||
|
revision.setComment(r.getMessage());
|
||||||
|
cvsfile.getRevisions().add(revision);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
RlogCommand rlog = new RlogCommand();
|
cvsfile.getAttributes().add(
|
||||||
StringTokenizer tk = new StringTokenizer(modules, ",");
|
CVSInfoImpl.this.getAttribute("TOTALREVISIONS",
|
||||||
while (tk.hasMoreTokens()) {
|
info.getTotalRevisions()));
|
||||||
rlog.setModule(tk.nextToken());
|
cvsfile.getAttributes().add(
|
||||||
|
CVSInfoImpl.this.getAttribute("BRANCH",
|
||||||
|
info.getBranch()));
|
||||||
|
cvsfile.getAttributes().add(
|
||||||
|
CVSInfoImpl.this.getAttribute(
|
||||||
|
"KEYWORDSUBSTITUTION",
|
||||||
|
info.getKeywordSubstitution()));
|
||||||
|
cvsfile.getAttributes().add(
|
||||||
|
CVSInfoImpl.this.getAttribute("LOCKS",
|
||||||
|
info.getLocks()));
|
||||||
|
cvsfile.getAttributes().add(
|
||||||
|
CVSInfoImpl.this.getAttribute("SELECTEDREVISIONS",
|
||||||
|
info.getSelectedRevisions()));
|
||||||
|
cvsfile.setROOT(cvsclient.getRoot().host + "@"
|
||||||
|
+ cvsclient.getRoot().repository);
|
||||||
|
|
||||||
|
CVSInfoImpl.this.list.getItems().add(cvsfile);
|
||||||
|
|
||||||
|
String key = CVSClient.generateID(cvsfile);
|
||||||
|
try {
|
||||||
|
CVSInfoImpl.this.getCacheInstance().put(key, cvsfile);
|
||||||
|
} catch (CacheException e) {
|
||||||
|
CVSInfoImpl.this.logger.error("Could not cache item '"
|
||||||
|
+ key + "'", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (rlog.getModules().length == 0)
|
});
|
||||||
rlog.setModule("");
|
RlogCommand rlog = new RlogCommand();
|
||||||
|
StringTokenizer tk = new StringTokenizer(modules, ",");
|
||||||
rlog.setDefaultBranch(true); // -b Print information about the
|
while (tk.hasMoreTokens()) {
|
||||||
// revisions on the default
|
rlog.setModule(tk.nextToken());
|
||||||
// branch,
|
|
||||||
// normally the highest branch
|
|
||||||
// on
|
|
||||||
// the trunk.
|
|
||||||
rlog.setNoTags(true); // -N Do not print the list of tags for
|
|
||||||
// this
|
|
||||||
// file. This option can be very useful
|
|
||||||
// when
|
|
||||||
// your site uses a lot of tags, so
|
|
||||||
// rather
|
|
||||||
// than "more"'ing over 3 pages of tag
|
|
||||||
// information, the log information is
|
|
||||||
// presented without tags at all.
|
|
||||||
rlog.setHeaderAndDescOnly(false); // -t Print only the name of
|
|
||||||
// the
|
|
||||||
// rcs file, name of the
|
|
||||||
// file in
|
|
||||||
// the working directory,
|
|
||||||
// head,
|
|
||||||
// default branch, access
|
|
||||||
// list,
|
|
||||||
// locks, symbolic names,
|
|
||||||
// and
|
|
||||||
// suffix. + description
|
|
||||||
// rlog.setRevisionFilter("1.1.");
|
|
||||||
// rlog.setSuppressHeader(true); // -S Supress log output when
|
|
||||||
// no
|
|
||||||
// revisions are selected within a file.
|
|
||||||
client.executeCommand(rlog, cvsclient.getGlobalOptions());
|
|
||||||
logger.info("Execute CVS command '" + rlog.getCVSCommand() + "' against '"+cvsclient.getRoot().host+"@" + cvsclient.getRoot().repository+"'");
|
|
||||||
//need to put a new list into cache as we will filter the result
|
|
||||||
//afterwards
|
|
||||||
getCacheInstance().put(cachekey, new ArrayList<FileType>(list));
|
|
||||||
|
|
||||||
|
|
||||||
} catch (ConfigurationException e) {
|
|
||||||
logger.error("CVS Configuration File '"
|
|
||||||
+ f.getAbsolutePath() + f.getName() + "'not found.", e);
|
|
||||||
|
|
||||||
} catch (CommandAbortedException e) {
|
|
||||||
// TODO Auto-generated catch block
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (AuthenticationException e) {
|
|
||||||
// TODO Auto-generated catch block
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (CommandException e) {
|
|
||||||
// TODO Auto-generated catch block
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (CacheException e) {
|
|
||||||
// TODO Auto-generated catch block
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
|
if (rlog.getModules().length == 0) {
|
||||||
|
rlog.setModule("");
|
||||||
|
}
|
||||||
|
rlog.setDefaultBranch(false);
|
||||||
|
|
||||||
|
rlog.setNoTags(false);
|
||||||
|
|
||||||
|
rlog.setHeaderAndDescOnly(false);
|
||||||
|
|
||||||
|
rlog.setRecursive(isRecursive);
|
||||||
|
|
||||||
|
this.logger.info("Executing CVS command '" + rlog.getCVSCommand()
|
||||||
|
+ "' against '" + cvsclient.getRoot().host + "@"
|
||||||
|
+ cvsclient.getRoot().repository + "'");
|
||||||
|
client.executeCommand(rlog, cvsclient.getGlobalOptions());
|
||||||
|
|
||||||
|
getCacheInstance().put(cachekey, this.list);
|
||||||
|
} catch (ConfigurationException e) {
|
||||||
|
this.logger.error("CVS Configuration File '" + f.getAbsolutePath()
|
||||||
|
+ f.getName() + "'not found.", e);
|
||||||
|
} catch (CommandAbortedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (AuthenticationException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (CommandException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (CacheException e) {
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// prepare output after everything is cached
|
|
||||||
if (!showRevisions) {
|
if (!showRevisions) {
|
||||||
for (FileType t : list) {
|
for (ItemType t : this.list.getItems()) {
|
||||||
t.clearRevisionList();
|
t.getRevisions().clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GenericEntity entity = new GenericEntity<List<FileType>>(list) {};
|
return Response.ok(this.list).build();
|
||||||
return Response.ok(entity).build();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Response getModules(HttpHeaders h, File f, boolean forceNoCache) {
|
public Response getModules(HttpHeaders h, File f, boolean forceNoCache) {
|
||||||
|
|
||||||
// Try to deliver from Cache
|
|
||||||
String cachekey = "Modules" + f.toURI().toString();
|
String cachekey = "Modules" + f.toURI().toString();
|
||||||
logger.debug("forceNoCache="+forceNoCache);
|
this.logger.debug("forceNoCache=" + forceNoCache);
|
||||||
List<ModuleType> response = (List<ModuleType>) getCacheInstance().get(
|
|
||||||
cachekey);
|
|
||||||
if (!forceNoCache && response != null) {
|
|
||||||
GenericEntity entity = new GenericEntity<List<ModuleType>>(response) {
|
|
||||||
};
|
|
||||||
return Response.ok(entity).build();
|
|
||||||
}
|
|
||||||
// -------------------------
|
|
||||||
|
|
||||||
|
ModuleListType response = (ModuleListType) getCacheInstance().get(
|
||||||
|
cachekey);
|
||||||
|
if ((!forceNoCache) && (response != null)) {
|
||||||
|
return Response.ok(response).build();
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
CVSClient cvsclient = new CVSClient(f);
|
CVSClient cvsclient = new CVSClient(f);
|
||||||
Client client = cvsclient.client;
|
Client client = cvsclient.client;
|
||||||
|
final ModuleListType list = this.FACTORY.createModuleListType();
|
||||||
final List<ModuleType> list = new ArrayList<ModuleType>();
|
|
||||||
|
|
||||||
client.getEventManager().addCVSListener(new BasicCVSListener() {
|
client.getEventManager().addCVSListener(new BasicCVSListener() {
|
||||||
public void fileInfoGenerated(FileInfoEvent e) {
|
public void fileInfoGenerated(FileInfoEvent e) {
|
||||||
ModuleListInformation info = (ModuleListInformation) e
|
ModuleListInformation info = (ModuleListInformation) e
|
||||||
.getInfoContainer();
|
.getInfoContainer();
|
||||||
|
ModuleType module = CVSInfoImpl.this.FACTORY
|
||||||
list.add(new ModuleType(info.getModuleName(), info
|
.createModuleType();
|
||||||
.getModuleStatus(), info.getPaths(), info.getType()));
|
module.setName(info.getModuleName());
|
||||||
|
module.setStatus(info.getModuleStatus());
|
||||||
|
module.setPath(info.getPaths());
|
||||||
|
module.setType(info.getType());
|
||||||
|
list.getModules().add(module);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
CheckoutCommand co = new CheckoutCommand();
|
CheckoutCommand co = new CheckoutCommand();
|
||||||
co.setShowModulesWithStatus(true);
|
co.setShowModulesWithStatus(true);
|
||||||
|
|
||||||
|
this.logger.info("Executing CVS command '" + co.getCVSCommand()
|
||||||
|
+ "' against '" + cvsclient.getRoot().host + "@"
|
||||||
|
+ cvsclient.getRoot().repository + "'");
|
||||||
client.executeCommand(co, cvsclient.getGlobalOptions());
|
client.executeCommand(co, cvsclient.getGlobalOptions());
|
||||||
logger.info("Execute CVS command '" + co.getCVSCommand() + "' against '"+cvsclient.getRoot().host+"@" + cvsclient.getRoot().repository+"'");
|
if (list.getModules().size() == 0) {
|
||||||
if(list.size()==0) {
|
this.logger.warn("Repository '"
|
||||||
logger.warn("Repository '" + cvsclient.getRoot().repository + "' does not have modules");
|
+ cvsclient.getRoot().repository
|
||||||
list.add(new ModuleType("","","",""));
|
+ "' does not have modules");
|
||||||
}
|
}
|
||||||
|
|
||||||
GenericEntity entity = new GenericEntity<List<ModuleType>>(list) {
|
|
||||||
};
|
|
||||||
getCacheInstance().put(cachekey, list);
|
getCacheInstance().put(cachekey, list);
|
||||||
return Response.ok(entity).build();
|
return Response.ok(list).build();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
return Response.serverError().build();
|
return Response.serverError().build();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public Response getTags(HttpHeaders h, File f, boolean withFiles) {
|
||||||
* Get the caching manager for CVS objects
|
String cachekey = f.toURI().toString() + ":taglist";
|
||||||
*
|
this.logger.debug("Retrieving Tags from cache using key '" + cachekey
|
||||||
* @return The CVSCaching JCS region
|
+ "'");
|
||||||
*/
|
TagListType tags = (TagListType) getCacheInstance().get(cachekey);
|
||||||
|
if (tags != null) {
|
||||||
|
this.logger.debug("Delivering Tags from cache.");
|
||||||
|
return Response.ok(tags).build();
|
||||||
|
}
|
||||||
|
this.logger.warn("Taglist not found in cache.");
|
||||||
|
return Response.noContent().build();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Response getFileContent(HttpHeaders h, File f, String filestring,
|
||||||
|
boolean forceNoCache) {
|
||||||
|
final ItemType result = this.FACTORY.createItemType();
|
||||||
|
final String cachekey = f.toURI().toString() + ":" + filestring
|
||||||
|
+ ":content";
|
||||||
|
ItemListType list = null;
|
||||||
|
|
||||||
|
if (!forceNoCache) {
|
||||||
|
this.logger.debug("Retrieving file content from cache using key '"
|
||||||
|
+ cachekey + "'");
|
||||||
|
list = (ItemListType) getCacheInstance().get(cachekey);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (list != null) {
|
||||||
|
this.logger.debug("Delivering file content from cache.");
|
||||||
|
return Response.ok(list).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.logger.warn("File content not found in cache.");
|
||||||
|
list = this.FACTORY.createItemListType();
|
||||||
|
try {
|
||||||
|
CVSClient cvsclient = new CVSClient(f);
|
||||||
|
Client client = cvsclient.getClient();
|
||||||
|
|
||||||
|
CheckoutCommand checkout = new CheckoutCommand();
|
||||||
|
BasicCVSListener listener = new BasicCVSListener() {
|
||||||
|
public void fileInfoGenerated(FileInfoEvent arg0) {
|
||||||
|
System.out.println(arg0.getInfoContainer().getFile()
|
||||||
|
.toURI().toString());
|
||||||
|
PipedFileInformation info = (PipedFileInformation) arg0
|
||||||
|
.getInfoContainer();
|
||||||
|
result.setName(info.getFile().getName());
|
||||||
|
try {
|
||||||
|
boolean isBinary = false;
|
||||||
|
result.setIsBinary(isBinary);
|
||||||
|
result.setRemotename(info.getRepositoryFileName());
|
||||||
|
RevisionType revision = CVSInfoImpl.this.FACTORY
|
||||||
|
.createRevisionType();
|
||||||
|
revision.setRevision(info.getRepositoryRevision());
|
||||||
|
revision.setComment("");
|
||||||
|
|
||||||
|
if (!isBinary) {
|
||||||
|
FileReader fin = new FileReader(info.getTempFile());
|
||||||
|
|
||||||
|
ByteArrayOutputStream bout = new ByteArrayOutputStream();
|
||||||
|
StringBuffer sbuf = new StringBuffer();
|
||||||
|
int c;
|
||||||
|
while ((c = fin.read()) != -1) {
|
||||||
|
bout.write(c);
|
||||||
|
sbuf.append((char) c);
|
||||||
|
}
|
||||||
|
result.setData(bout.toByteArray());
|
||||||
|
result.setContent(sbuf.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (IOException e2) {
|
||||||
|
e2.printStackTrace();
|
||||||
|
} catch (NullPointerException ne) {
|
||||||
|
ne.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
String key = CVSClient.generateID(result);
|
||||||
|
try {
|
||||||
|
CVSInfoImpl.this.getCacheInstance().put(cachekey,
|
||||||
|
result);
|
||||||
|
} catch (CacheException e1) {
|
||||||
|
e1.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
client.getEventManager().addCVSListener(listener);
|
||||||
|
|
||||||
|
checkout.setModule(filestring);
|
||||||
|
checkout.setPipeToOutput(true);
|
||||||
|
|
||||||
|
this.logger.info("Execute CVS command '" + checkout.getCVSCommand()
|
||||||
|
+ "' against '" + cvsclient.getRoot().host + "@"
|
||||||
|
+ cvsclient.getRoot().repository + "'");
|
||||||
|
client.executeCommand(checkout, cvsclient.getGlobalOptions());
|
||||||
|
} catch (CommandAbortedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (ConfigurationException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (AuthenticationException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (CommandException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result.getContent() != null) {
|
||||||
|
return Response.ok(result).build();
|
||||||
|
}
|
||||||
|
return Response.noContent().build();
|
||||||
|
}
|
||||||
|
|
||||||
public JCS getCacheInstance() {
|
public JCS getCacheInstance() {
|
||||||
JCS jcs = null;
|
JCS jcs = null;
|
||||||
final String cacheinstance = "CVSCache";
|
String cacheinstance = "CVSCache";
|
||||||
try {
|
try {
|
||||||
logger.debug("Getting cache instance named '"+cacheinstance+"'" );
|
this.logger.trace("Getting cache instance named 'CVSCache'");
|
||||||
jcs = JCS.getInstance(cacheinstance);
|
jcs = JCS.getInstance("CVSCache");
|
||||||
} catch (CacheException e) {
|
} catch (CacheException e) {
|
||||||
logger.error("Failed to get cache instance", e);
|
this.logger.error("Failed to get cache instance", e);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
return jcs;
|
return jcs;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
public Response searchFileContent(HttpHeaders h, File f,
|
||||||
|
String file_regexp, String content_regexp, boolean forceNoCache) {
|
||||||
|
try {
|
||||||
|
CVSClient client = new CVSClient(f);
|
||||||
|
String cvsroot = client.getRoot().host + "@"
|
||||||
|
+ client.getRoot().repository;
|
||||||
|
|
||||||
|
String cachestring = "FINDINGS-" + cvsroot;
|
||||||
|
this.logger
|
||||||
|
.debug("Fetch searchFileContent response from cache using cachekey '"
|
||||||
|
+ cachestring + "'");
|
||||||
|
FindingsListType result = (FindingsListType) getCacheInstance()
|
||||||
|
.get(cachestring);
|
||||||
|
if (result != null)
|
||||||
|
this.logger.debug("Found object for key '" + cachestring
|
||||||
|
+ "' in cache.");
|
||||||
|
else {
|
||||||
|
this.logger.debug("Found no object for key '" + cachestring
|
||||||
|
+ "' in cache.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result != null)
|
||||||
|
return Response.ok(result).build();
|
||||||
|
} catch (CommandAbortedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (ConfigurationException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (AuthenticationException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return Response.noContent().build();
|
||||||
|
}
|
||||||
|
|
||||||
|
private AttributeType getAttribute(String name, String value) {
|
||||||
|
AttributeType attribute = this.FACTORY.createAttributeType();
|
||||||
|
attribute.setName(name);
|
||||||
|
attribute.setValue(value);
|
||||||
|
return attribute;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,63 +1,20 @@
|
||||||
/*
|
|
||||||
* Copyright 2012 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.ws.rs;
|
package net.brutex.xservices.ws.rs;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.ws.rs.DefaultValue;
|
import javax.ws.rs.DefaultValue;
|
||||||
import javax.ws.rs.GET;
|
import javax.ws.rs.GET;
|
||||||
import javax.ws.rs.Path;
|
import javax.ws.rs.Path;
|
||||||
import javax.ws.rs.PathParam;
|
|
||||||
import javax.ws.rs.Produces;
|
import javax.ws.rs.Produces;
|
||||||
import javax.ws.rs.QueryParam;
|
import javax.ws.rs.QueryParam;
|
||||||
import javax.ws.rs.core.Context;
|
import javax.ws.rs.core.Context;
|
||||||
import javax.ws.rs.core.HttpHeaders;
|
import javax.ws.rs.core.HttpHeaders;
|
||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
|
|
||||||
import net.brutex.xservices.types.FileInfoType;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Path("/FileService/")
|
@Path("/FileService/")
|
||||||
@Produces ("application/xml")
|
@Produces({"application/xml"})
|
||||||
public interface FileInfo {
|
public abstract interface FileInfo
|
||||||
|
{
|
||||||
/**
|
@GET
|
||||||
* @param dir
|
@Path("getFiles/")
|
||||||
* @param withDir
|
public abstract Response getFiles(@Context HttpHeaders paramHttpHeaders, @QueryParam("directory") String paramString1, @QueryParam("includeDirectories") @DefaultValue("0") boolean paramBoolean1, @QueryParam("includeFiles") @DefaultValue("1") boolean paramBoolean2, @QueryParam("depth") @DefaultValue("1") int paramInt1, @QueryParam("search") String paramString2, @QueryParam("itemsPerPage") @DefaultValue("50") int paramInt2, @QueryParam("page") @DefaultValue("1") int paramInt3);
|
||||||
* @param withFiles
|
|
||||||
* @param depth
|
|
||||||
* @param search
|
|
||||||
* @param count
|
|
||||||
* @param page
|
|
||||||
* @return List of File
|
|
||||||
*/
|
|
||||||
@GET
|
|
||||||
@Path("getFiles/")
|
|
||||||
public Response getFiles(@Context HttpHeaders h,
|
|
||||||
@QueryParam("directory") String dir,
|
|
||||||
@QueryParam("includeDirectories") @DefaultValue("0") boolean withDir,
|
|
||||||
@QueryParam("includeFiles") @DefaultValue("1") boolean withFiles,
|
|
||||||
@QueryParam("depth") @DefaultValue("1") int depth,
|
|
||||||
@QueryParam("search") String search,
|
|
||||||
@QueryParam("itemsPerPage") @DefaultValue("50") int count,
|
|
||||||
@QueryParam("page") @DefaultValue("1") int page);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,103 +2,94 @@ package net.brutex.xservices.ws.rs;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileFilter;
|
import java.io.FileFilter;
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.ws.rs.core.GenericEntity;
|
import javax.ws.rs.core.GenericEntity;
|
||||||
import javax.ws.rs.core.HttpHeaders;
|
import javax.ws.rs.core.HttpHeaders;
|
||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
|
|
||||||
import org.apache.jcs.JCS;
|
|
||||||
import org.apache.jcs.access.exception.CacheException;
|
|
||||||
|
|
||||||
import net.brutex.xservices.security.StandardSecurityManager;
|
import net.brutex.xservices.security.StandardSecurityManager;
|
||||||
import net.brutex.xservices.security.UserIdentity;
|
import net.brutex.xservices.security.UserIdentity;
|
||||||
import net.brutex.xservices.types.FileInfoType;
|
import net.brutex.xservices.types.FileInfoType;
|
||||||
|
|
||||||
|
import org.apache.jcs.JCS;
|
||||||
|
import org.apache.jcs.access.exception.CacheException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Brian Rosenberger
|
* @author Brian Rosenberger, bru(at)brutex.de
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class FileInfoImpl implements FileInfo {
|
public class FileInfoImpl implements FileInfo
|
||||||
|
{
|
||||||
|
public Response getFiles(HttpHeaders h, String dir, boolean withDir, boolean withFiles, int level, String search, int count, int page)
|
||||||
|
{
|
||||||
|
StandardSecurityManager sec = new StandardSecurityManager();
|
||||||
|
UserIdentity id = new UserIdentity();
|
||||||
|
|
||||||
public Response getFiles(HttpHeaders h, String dir, boolean withDir,
|
if (!sec.canExecute(java.lang.Thread.currentThread().getStackTrace()[1].getMethodName(), id)) {
|
||||||
boolean withFiles, int level, String search, int count, int page) {
|
return null;
|
||||||
|
}
|
||||||
StandardSecurityManager sec = new StandardSecurityManager();
|
|
||||||
UserIdentity id = new UserIdentity();
|
|
||||||
|
|
||||||
|
System.out.println("Listing directory: " + dir);
|
||||||
if( ! sec.canExecute(Thread.currentThread().getStackTrace()[1].getMethodName(), id)) {
|
if (level <= 0) level = 1;
|
||||||
return null;
|
if (level > 3) level = 3;
|
||||||
}
|
if ((!withDir) && (!withFiles)) withFiles = true;
|
||||||
|
String cachekey = level + "||" + withFiles + "||" + withDir + "||" + search + "||" + dir;
|
||||||
|
try {
|
||||||
|
JCS jcs = JCS.getInstance("FileCache");
|
||||||
|
|
||||||
|
List list = (List)jcs.get(cachekey);
|
||||||
System.out.println("Listing directory: " + dir);
|
if (list == null) {
|
||||||
if(level <= 0) level = 1;
|
list = setDirectory(dir, withDir, withFiles, level, search);
|
||||||
if(level > 3) level = 3;
|
jcs.put(cachekey, list);
|
||||||
if(!withDir && !withFiles) withFiles = true;
|
System.out.println("Stored in Cache: " + list.toString());
|
||||||
String cachekey = level +"||"+ withFiles +"||"+ withDir +"||" + search + "||" + dir;
|
} else {
|
||||||
try {
|
System.out.println("Got from Cache: " + list.toString());
|
||||||
JCS jcs = JCS.getInstance("FileCache");
|
}
|
||||||
|
|
||||||
List<FileInfoType> list = (List<FileInfoType>) jcs.get(cachekey);
|
|
||||||
if(list == null) {
|
|
||||||
list = setDirectory(dir, withDir, withFiles, level, search);
|
|
||||||
jcs.put(cachekey, list);
|
|
||||||
System.out.println("Stored in Cache: " + list.toString());
|
|
||||||
} else {
|
|
||||||
System.out.println("Got from Cache: " + list.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
int fromIndex = 0;
|
||||||
int fromIndex = 0;
|
int toIndex = 0;
|
||||||
int toIndex = 0;
|
fromIndex = (page - 1) * count;
|
||||||
fromIndex = (page-1) * count;
|
toIndex = page * count;
|
||||||
toIndex = (page*count);
|
if (toIndex > list.size()) toIndex = list.size();
|
||||||
if(toIndex>list.size()) toIndex = list.size();
|
if (fromIndex > toIndex) fromIndex = toIndex;
|
||||||
if(fromIndex>toIndex) fromIndex=toIndex;
|
GenericEntity sublist = new GenericEntity(list.subList(fromIndex, toIndex))
|
||||||
GenericEntity<List<FileInfoType>> sublist = new GenericEntity<List<FileInfoType>>(list.subList(fromIndex, toIndex) ){};
|
{
|
||||||
return Response.ok( sublist ).build();
|
};
|
||||||
} catch (CacheException e) {
|
return Response.ok(sublist).build();
|
||||||
Response.serverError().build();
|
} catch (CacheException e) {
|
||||||
}
|
Response.serverError().build();
|
||||||
return null;
|
}
|
||||||
}
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setDirectory(List<FileInfoType> list, File dir, boolean withDirectories, boolean withFiles, final int depth, final String search)
|
||||||
|
{
|
||||||
|
if (depth <= 0) return;
|
||||||
|
|
||||||
|
File[] files = dir.listFiles(new FileFilter()
|
||||||
private void setDirectory(List<FileInfoType> list, File dir, final boolean withDirectories, final boolean withFiles, final int depth, final String search) {
|
{
|
||||||
if(depth <=0) return;
|
public boolean accept(File pathname) {
|
||||||
|
if ((pathname.isDirectory()) && (depth > 1)) return true;
|
||||||
File[] files = dir.listFiles(new FileFilter() {
|
if ((search == null) || (search.equals(""))) return true;
|
||||||
|
if (!pathname.getAbsolutePath().contains(search)) return false;
|
||||||
public boolean accept(File pathname) {
|
return true;
|
||||||
if(pathname.isDirectory() && depth > 1) return true;
|
}
|
||||||
if(search == null || search.equals("")) return true;
|
});
|
||||||
if(!pathname.getAbsolutePath().contains(search)) return false;
|
if ((dir.getParentFile() != null) && (withDirectories)) list.add(new FileInfoType(dir.getParentFile()));
|
||||||
return true;
|
if (files == null) return;
|
||||||
}
|
|
||||||
});
|
for (File e : files) {
|
||||||
if(dir.getParentFile() != null && withDirectories==true) list.add(new FileInfoType(dir.getParentFile()));
|
if (e.isDirectory()) setDirectory(list, e, withDirectories, withFiles, depth - 1, search);
|
||||||
if(files==null) return;
|
if (((withDirectories) && (e.isDirectory())) || (
|
||||||
|
(withFiles) && (e.isFile())))
|
||||||
for( File e : files) {
|
list.add(new FileInfoType(e));
|
||||||
if(e.isDirectory()) setDirectory(list, e, withDirectories, withFiles, depth-1, search);
|
}
|
||||||
if( (withDirectories && e.isDirectory())
|
}
|
||||||
|| (withFiles && e.isFile()) ) {
|
|
||||||
list.add(new FileInfoType(e));
|
private List<FileInfoType> setDirectory(String dir, boolean withDirectories, boolean withFiles, int depth, String search)
|
||||||
}
|
{
|
||||||
}
|
List list = new ArrayList();
|
||||||
}
|
setDirectory(list, new File(dir), withDirectories, withFiles, depth, search);
|
||||||
|
return list;
|
||||||
private List<FileInfoType> setDirectory(String dir, final boolean withDirectories, final boolean withFiles, int depth, String search) {
|
}
|
||||||
List<FileInfoType> list = new ArrayList<FileInfoType>();
|
}
|
||||||
setDirectory( list, (new File(dir)), withDirectories, withFiles, depth, search);
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -2,17 +2,20 @@ package net.brutex.xservices.ws.rs;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
import javax.xml.bind.annotation.XmlType;
|
|
||||||
|
|
||||||
@XmlRootElement(name="FileList")
|
@XmlRootElement(name="FileList")
|
||||||
public class FileListType {
|
public class FileListType
|
||||||
|
{
|
||||||
|
|
||||||
@XmlElement
|
@XmlElement
|
||||||
public String name;
|
public String name;
|
||||||
|
|
||||||
public FileListType(){};
|
|
||||||
public FileListType(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
public FileListType()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public FileListType(String name)
|
||||||
|
{
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
package net.brutex.xservices.ws.rs;
|
||||||
|
|
||||||
|
import net.brutex.xservices.types.scm.ItemType;
|
||||||
|
|
||||||
|
class ResultType
|
||||||
|
{
|
||||||
|
private ItemType result = null;
|
||||||
|
|
||||||
|
ItemType getResult()
|
||||||
|
{
|
||||||
|
return this.result;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setResult(ItemType result)
|
||||||
|
{
|
||||||
|
this.result = result;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue