本文整理汇总了Java中gov.nih.nci.cagrid.common.Utils类的典型用法代码示例。如果您正苦于以下问题:Java Utils类的具体用法?Java Utils怎么用?Java Utils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Utils类属于gov.nih.nci.cagrid.common包,在下文中一共展示了Utils类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getUserPolicies
import gov.nih.nci.cagrid.common.Utils; //导入依赖的package包/类
/**
* This method returns the list of IdP user policies supported by Dorian.
*
* @return The list of IdP user policies supported by Dorian.
* @throws DorianFault
* @throws PermissionDeniedFault
* @throws DorianInternalFault
*/
public List<GridUserPolicy> getUserPolicies() throws DorianFault, PermissionDeniedFault, DorianInternalFault {
try {
List<GridUserPolicy> list = Utils.asList(getClient().getGridUserPolicies());
return list;
} catch (DorianInternalFault gie) {
throw gie;
} catch (PermissionDeniedFault f) {
throw f;
} catch (Exception e) {
FaultUtil.printFault(e);
DorianFault fault = new DorianFault();
fault.setFaultString(Utils.getExceptionMessage(e));
FaultHelper helper = new FaultHelper(fault);
helper.addFaultCause(e);
fault = (DorianFault) helper.getFault();
throw fault;
}
}
示例2: getOwnedHostCertificates
import gov.nih.nci.cagrid.common.Utils; //导入依赖的package包/类
/**
* This method returns a list for all the host certificates owned by the
* user.
*
* @return The list of host certificates owned by the user.
* @throws DorianFault
* @throws DorianInternalFault
* @throws PermissionDeniedFault
*/
public List<HostCertificateRecord> getOwnedHostCertificates() throws DorianFault, DorianInternalFault,
PermissionDeniedFault {
try {
List<HostCertificateRecord> list = Utils.asList(getClient().getOwnedHostCertificates());
return list;
} catch (DorianInternalFault gie) {
throw gie;
} catch (PermissionDeniedFault f) {
throw f;
} catch (Exception e) {
FaultUtil.printFault(e);
DorianFault fault = new DorianFault();
fault.setFaultString(Utils.getExceptionMessage(e));
FaultHelper helper = new FaultHelper(fault);
helper.addFaultCause(e);
fault = (DorianFault) helper.getFault();
throw fault;
}
}
示例3: getServiceMetadata
import gov.nih.nci.cagrid.common.Utils; //导入依赖的package包/类
/**
* This method obtains the service metadata for the service.
*
* @return The service metadata.
* @throws ResourcePropertyRetrievalException
*/
public ServiceMetadata getServiceMetadata() throws InvalidResourcePropertyException,
ResourcePropertyRetrievalException {
if (serviceMetadata == null) {
Element resourceProperty = null;
InputStream wsdd = getClass().getResourceAsStream("client-config.wsdd");
resourceProperty = ResourcePropertyHelper.getResourceProperty(client.getEndpointReference(),
SERVICE_METADATA, wsdd);
try {
this.serviceMetadata = (ServiceMetadata) Utils.deserializeObject(new StringReader(XmlUtils
.toString(resourceProperty)), ServiceMetadata.class);
} catch (Exception e) {
throw new ResourcePropertyRetrievalException("Unable to deserailize: " + e.getMessage(), e);
}
}
return this.serviceMetadata;
}
示例4: addAdmin
import gov.nih.nci.cagrid.common.Utils; //导入依赖的package包/类
/**
* This method grants a user privileges to Dorian to administrate grid
* accounts.
*
* @param gridIdentity
* The Grid identity of the user to add as an administrator.
* @throws DorianFault
* @throws DorianInternalFault
* @throws PermissionDeniedFault
*/
public void addAdmin(java.lang.String gridIdentity) throws DorianFault, DorianInternalFault, PermissionDeniedFault {
try {
getClient().addAdmin(gridIdentity);
} catch (DorianInternalFault gie) {
throw gie;
} catch (PermissionDeniedFault f) {
throw f;
} catch (Exception e) {
FaultUtil.printFault(e);
DorianFault fault = new DorianFault();
fault.setFaultString(Utils.getExceptionMessage(e));
FaultHelper helper = new FaultHelper(fault);
helper.addFaultCause(e);
fault = (DorianFault) helper.getFault();
throw fault;
}
}
示例5: storeExtensionData
import gov.nih.nci.cagrid.common.Utils; //导入依赖的package包/类
protected void storeExtensionData(Data data) throws Exception {
File serviceModelFile = new File(serviceInfo.getBaseDirectory(), IntroduceConstants.INTRODUCE_XML_FILE);
ServiceDescription serviceDesc = serviceInfo.getServiceDescriptor();
ExtensionType[] extensions = serviceDesc.getExtensions().getExtension();
ExtensionType dataExtension = null;
for (int i = 0; i < extensions.length; i++) {
if (extensions[i].getName().equals("data")) {
dataExtension = extensions[i];
break;
}
}
if (dataExtension.getExtensionData() == null) {
dataExtension.setExtensionData(new ExtensionTypeExtensionData());
}
ExtensionDataUtils.storeExtensionData(dataExtension.getExtensionData(), data);
Utils.serializeDocument(serviceModelFile.getAbsolutePath(), serviceDesc, IntroduceConstants.INTRODUCE_SKELETON_QNAME);
}
示例6: storeExtensionDataElement
import gov.nih.nci.cagrid.common.Utils; //导入依赖的package包/类
private void storeExtensionDataElement(ExtensionTypeExtensionData extensionData, Element elem) throws Exception {
MessageElement[] anys = extensionData.get_any();
for (int i = 0; (anys != null) && (i < anys.length); i++) {
if (anys[i].getQName().equals(Data.getTypeDesc().getXmlType())) {
// remove the old extension data
anys = (MessageElement[]) Utils.removeFromArray(anys, anys[i]);
break;
}
}
// create a message element from the JDom element
MessageElement data = null;
try {
data = AxisJdomUtils.fromElement(elem);
} catch (JDOMException ex) {
throw new Exception(
"Error converting extension data to Axis message element: " + ex.getMessage(), ex);
}
anys = (MessageElement[]) Utils.appendToArray(anys, data);
extensionData.set_any(anys);
}
示例7: loadCertificates
import gov.nih.nci.cagrid.common.Utils; //导入依赖的package包/类
public void loadCertificates(){
try{
File certFile = new File(getCertificateFileName());
if(!certFile.exists()){
throw new Exception("Certificate file not found at: " + certFile.getAbsolutePath());
}
Reader certReader = new FileReader(certFile);
X509Certificate cert = CertUtil.loadCertificate(certReader);
if(cert == null){
throw new Exception("Failed to load certificate.");
}
setCertificate(cert);
File keyFile = new File(getPrivateKeyFileName());
if(!keyFile.exists()){
throw new Exception("Private Key file not found at: " + keyFile.getAbsolutePath());
}
PrivateKey key = KeyUtil.loadPrivateKey(keyFile, Utils.clean(getPassword()));
if(key == null){
throw new Exception("Failed to load private key.");
}
setPrivateKey(key);
}catch(Exception ex){
throw new RuntimeException("Error loading certificates: " + ex.getMessage(), ex);
}
}
示例8: getCachedResults
import gov.nih.nci.cagrid.common.Utils; //导入依赖的package包/类
private CQLQueryResultsType getCachedResults()
throws Exception
{
File[] files = dataDir.listFiles(new FileFilter() {
public boolean accept(File file) {
return file.isFile();
}
});
CQLQueryResultType[] results = new CQLQueryResultType[files.length];
for (int i = 0; i < files.length; i++) {
System.out.println("RPDataImpl reading file: " + files[i]);
String xml = Utils.fileToStringBuffer(files[i]).toString();
Document doc = XMLUtils.newDocument(new InputSource(new StringReader(xml)));
MessageElement msg = new MessageElement(doc.getDocumentElement());
msg.setType(new QName("rproteomics.cabig.duke.edu/1/scanFeatures", "scanFeatures"));
results[i] = new CQLQueryResultType(new MessageElement[]{msg});
}
return new CQLQueryResultsType(results);
}
示例9: main
import gov.nih.nci.cagrid.common.Utils; //导入依赖的package包/类
public static void main(String[] args) {
String fqpURL = "http://localhost:8080/wsrf/services/cagrid/FederatedQueryProcessor";
try {
FederatedQueryProcessorClient fqpClient = new FederatedQueryProcessorClient(fqpURL);
DCQLQuery dcql = Utils.deserializeDocument(args[0], DCQLQuery.class);
FederatedQueryResultsClient resultsClient = fqpClient.executeAsynchronously(dcql);
System.out.print("Waiting for query to complete");
while (!resultsClient.isProcessingComplete()) {
Thread.sleep(500);
System.out.print(".");
}
System.out.println();
System.out.println("Done, iterating results");
CQLQueryResults results = resultsClient.getAggregateResults();
CQLQueryResultsIterator iterator = new CQLQueryResultsIterator(results, true);
int resultCount = 0;
while (iterator.hasNext()) {
System.out.println("=====RESULT [" + resultCount++ + "] =====");
System.out.println(iterator.next());
System.out.println("=====END RESULT=====\n\n");
}
System.exit(0);
} catch (Exception e) {
e.printStackTrace();
}
}
示例10: DorianImpl
import gov.nih.nci.cagrid.common.Utils; //导入依赖的package包/类
public DorianImpl() throws RemoteException {
try {
EndpointReferenceType type = AddressingUtils.createEndpointReference(null);
String configFile = DorianConfiguration.getConfiguration().getDorianConfiguration();
String propertiesFile = DorianConfiguration.getConfiguration().getDorianProperties();
BeanUtils utils = new BeanUtils(new FileSystemResource(configFile), new FileSystemResource(propertiesFile));
DorianProperties conf = utils.getDorianProperties();
this.dorian = new Dorian(conf, type.getAddress().toString());
getResourceHome().getAddressedResource().setDorian(this.dorian);
QName[] list = new QName[1];
list[0] = AuthenticationProfile.BASIC_AUTHENTICATION;
AuthenticationProfiles profiles = new AuthenticationProfiles();
profiles.setProfile(list);
getResourceHome().getAddressedResource().setAuthenticationProfiles(profiles);
utils.getEventManager().logEvent(AuditConstants.SYSTEM_ID, AuditConstants.SYSTEM_ID,
FederationAudit.SystemStartup.getValue(), "System successfully started!!!");
} catch (Exception e) {
FaultHelper.printStackTrace(e);
throw new RemoteException(Utils.getExceptionMessage(e));
}
}
示例11: addService
import gov.nih.nci.cagrid.common.Utils; //导入依赖的package包/类
public synchronized void addService(PhotoSharingHandle handle) {
if (services.containsKey(handle.getDisplayName())) {
ErrorDialog
.showError("The Photo Sharing service " + handle.getDisplayName() + " has already been added!!!");
} else {
getTree().startEvent("Loading service.... ");
try {
ServiceTreeNode node = new ServiceTreeNode(getTree(), handle);
synchronized (getTree()) {
this.add(node);
getTree().reload(this);
}
node.loadService();
getTree().stopEvent("");
this.services.put(handle.getDisplayName(), node);
} catch (Exception e) {
ErrorDialog.showError(Utils.getExceptionMessage(e),e);
getTree().stopEvent("");
}
}
}
示例12: getAttribute
import gov.nih.nci.cagrid.common.Utils; //导入依赖的package包/类
private String getAttribute(SAMLAssertion saml, String namespace, String name) throws InvalidAssertionFault {
Iterator itr = saml.getStatements();
while (itr.hasNext()) {
Object o = itr.next();
if (o instanceof SAMLAttributeStatement) {
SAMLAttributeStatement att = (SAMLAttributeStatement) o;
Iterator attItr = att.getAttributes();
while (attItr.hasNext()) {
SAMLAttribute a = (SAMLAttribute) attItr.next();
if ((a.getNamespace().equals(namespace)) && (a.getName().equals(name))) {
Iterator vals = a.getValues();
while (vals.hasNext()) {
String val = Utils.clean((String) vals.next());
if (val != null) {
return val;
}
}
}
}
}
}
InvalidAssertionFault fault = new InvalidAssertionFault();
fault.setFaultString("The assertion does not contain the required attribute, " + namespace + ":" + name);
throw fault;
}
示例13: register
import gov.nih.nci.cagrid.common.Utils; //导入依赖的package包/类
private void register() {
try {
getRegister().setEnabled(false);
getProgress().showProgress("Registering for tutorial....");
PhotoSharingRegistrationClient client = new PhotoSharingRegistrationClient(
org.cagrid.tutorials.photosharing.Utils.getRegistrationService(), ProxyUtil.getDefaultProxy());
client.registerPhotoSharingService(CertUtil.subjectToIdentity(getHostCertificates()
.getSelectedHostCertificate().getSubject()));
getProgress().stopProgress();
getRegister().setEnabled(true);
dispose();
GridApplication.getContext().showMessage(
"Congratulations you have successfully registered for the photo sharing tutorial.");
} catch (Exception e) {
getProgress().stopProgress();
ErrorDialog.showError(Utils.getExceptionMessage(e), e);
getRegister().setEnabled(true);
}
}
示例14: getCACertificate
import gov.nih.nci.cagrid.common.Utils; //导入依赖的package包/类
/**
* This method obtains Dorian's CA certificate.
*
* @return This method obtains Dorian's CA certificate.
* @throws DorianFault
* @throws DorianInternalFault
*/
public X509Certificate getCACertificate() throws DorianFault, DorianInternalFault {
try {
return CertUtil.loadCertificate(getClient().getCACertificate().getCertificateAsString());
} catch (DorianInternalFault gie) {
throw gie;
} catch (Exception e) {
FaultUtil.printFault(e);
DorianFault fault = new DorianFault();
fault.setFaultString(Utils.getExceptionMessage(e));
FaultHelper helper = new FaultHelper(fault);
helper.addFaultCause(e);
fault = (DorianFault) helper.getFault();
throw fault;
}
}
示例15: writeOutAuditorConfiguration
import gov.nih.nci.cagrid.common.Utils; //导入依赖的package包/类
protected void writeOutAuditorConfiguration(Data extData, ServiceInformation serviceInfo) throws CodegenExtensionException {
if (CommonTools.servicePropertyExists(
serviceInfo.getServiceDescriptor(),
DataServiceConstants.DATA_SERVICE_AUDITORS_CONFIG_FILE_PROPERTY)) {
try {
// get the name of the auditor config file
String filename = CommonTools.getServicePropertyValue(
serviceInfo.getServiceDescriptor(),
DataServiceConstants.DATA_SERVICE_AUDITORS_CONFIG_FILE_PROPERTY);
if (extData.getDataServiceAuditors() != null) {
File outFile = new File(serviceInfo.getBaseDirectory().getAbsolutePath()
+ File.separator + "etc" + File.separator + filename);
FileWriter writer = new FileWriter(outFile);
Utils.serializeObject(extData.getDataServiceAuditors(),
DataServiceConstants.DATA_SERVICE_AUDITORS_QNAME, writer);
writer.flush();
writer.close();
}
} catch (Exception ex) {
ex.printStackTrace();
throw new CodegenExtensionException(
"Error writing auditor configuration: " + ex.getMessage(), ex);
}
}
}