Skip to content

Commit

Permalink
Merge pull request #677 from jianghaolu/exp
Browse files Browse the repository at this point in the history
Move fluent interface work into public repo
  • Loading branch information
jianghaolu committed May 4, 2016
2 parents 96829b6 + 451c424 commit 0f8a407
Show file tree
Hide file tree
Showing 1,909 changed files with 203,052 additions and 214,750 deletions.
38 changes: 19 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,29 @@
This project provides a client library in Java that makes it easy to consume Microsoft Azure services. For documentation please see the [JavaDocs](http://azure.github.io/azure-sdk-for-java). For a list of libraries and how they are organized, please see the [Azure SDK for Java Features Wiki page] (https://github.com/Azure/azure-sdk-for-java/wiki/Azure-SDK-for-Java-Features).

#Download
Download via Maven:
To compile either this repo or your project depending on this, you need snapshot builds in private internal maven repo. Go to http://azuresdkci.cloudapp.net/view/4-Java/job/register-internal-maven/ and register. And then add these to your `$MAVEN_HOME/conf/settings.xml`.
```xml
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure</artifactId>
<version>1.0.0-beta1</version>
</dependency>
```
or Gradle:
```groovy
repositories {
mavenCentral()
....
}
...
dependencies {
compile 'com.microsoft.azure:azure:1.0.0-beta1'
....
}
<servers>
<!-- other server settings -->
<server>
<id>azureoss-snapshots-pr</id>
<username>your username</username>
<password>your password</password>
</server>
</servers>
```
To use the latest snapshot build,
and add the following to your pom:
```xml
<repositories>
<repository>
<id>azureoss-snapshots-pr</id>
<name>Azure Internal Snapshots</name>
<url>http://azureoss.westus.cloudapp.azure.com:8080/nexus/content/repositories/snapshots-pr/</url>
<layout>default</layout>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>adx-snapshots</id>
<name>Azure ADX Snapshots</name>
Expand Down
6 changes: 4 additions & 2 deletions azure-batch/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure</artifactId>
<artifactId>azure-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../azure/pom.xml</relativePath>
<relativePath>../pom.xml</relativePath>
</parent>

<artifactId>azure-batch</artifactId>
Expand Down Expand Up @@ -49,6 +49,7 @@
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-client-runtime</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
Expand All @@ -63,6 +64,7 @@
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-client-authentication</artifactId>
<version>1.0.0-beta1</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
package com.microsoft.azure.batch;

import com.microsoft.azure.PagedList;
import com.microsoft.azure.batch.protocol.models.*;
import com.microsoft.azure.batch.protocol.implementation.api.AccountListNodeAgentSkusHeadersInner;
import com.microsoft.azure.batch.protocol.implementation.api.AccountListNodeAgentSkusOptionsInner;
import com.microsoft.azure.batch.protocol.implementation.api.BatchErrorException;
import com.microsoft.azure.batch.protocol.implementation.api.NodeAgentSkuInner;
import com.microsoft.rest.ServiceResponseWithHeaders;

import java.io.IOException;
Expand Down Expand Up @@ -37,21 +40,21 @@ public void setCustomBehaviors(Collection<BatchClientBehavior> behaviors) {
_customBehaviors = behaviors;
}

public List<NodeAgentSku> listNodeAgentSkus() throws BatchErrorException, IOException {
public List<NodeAgentSkuInner> listNodeAgentSkus() throws BatchErrorException, IOException {
return listNodeAgentSkus(null, null);
}

public List<NodeAgentSku> listNodeAgentSkus(DetailLevel detailLevel) throws BatchErrorException, IOException {
public List<NodeAgentSkuInner> listNodeAgentSkus(DetailLevel detailLevel) throws BatchErrorException, IOException {
return listNodeAgentSkus(detailLevel, null);
}

public List<NodeAgentSku> listNodeAgentSkus(DetailLevel detailLevel, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
AccountListNodeAgentSkusOptions options = new AccountListNodeAgentSkusOptions();
public List<NodeAgentSkuInner> listNodeAgentSkus(DetailLevel detailLevel, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
AccountListNodeAgentSkusOptionsInner options = new AccountListNodeAgentSkusOptionsInner();
BehaviorManager bhMgr = new BehaviorManager(this.getCustomBehaviors(), additionalBehaviors);
bhMgr.appendDetailLevelToPerCallBehaviors(detailLevel);
bhMgr.applyRequestBehaviors(options);

ServiceResponseWithHeaders<PagedList<NodeAgentSku>, AccountListNodeAgentSkusHeaders> response = this._parentBatchClient.getProtocolLayer().getAccountOperations().listNodeAgentSkus(options);
ServiceResponseWithHeaders<PagedList<NodeAgentSkuInner>, AccountListNodeAgentSkusHeadersInner> response = this._parentBatchClient.getProtocolLayer().accounts().listNodeAgentSkus(options);

return response.getBody();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@
package com.microsoft.azure.batch;

import com.microsoft.azure.PagedList;
import com.microsoft.azure.batch.protocol.models.*;
import com.microsoft.azure.batch.protocol.implementation.api.ApplicationGetHeadersInner;
import com.microsoft.azure.batch.protocol.implementation.api.ApplicationGetOptionsInner;
import com.microsoft.azure.batch.protocol.implementation.api.ApplicationListHeadersInner;
import com.microsoft.azure.batch.protocol.implementation.api.ApplicationListOptionsInner;
import com.microsoft.azure.batch.protocol.implementation.api.ApplicationSummaryInner;
import com.microsoft.azure.batch.protocol.implementation.api.BatchErrorException;
import com.microsoft.rest.ServiceResponseWithHeaders;

import java.io.IOException;
Expand Down Expand Up @@ -37,30 +42,30 @@ public void setCustomBehaviors(Collection<BatchClientBehavior> behaviors) {
_customBehaviors = behaviors;
}

public List<ApplicationSummary> listApplications() throws BatchErrorException, IOException {
public List<ApplicationSummaryInner> listApplications() throws BatchErrorException, IOException {
return listApplications(null);
}

public List<ApplicationSummary> listApplications(Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
ApplicationListOptions options = new ApplicationListOptions();
public List<ApplicationSummaryInner> listApplications(Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
ApplicationListOptionsInner options = new ApplicationListOptionsInner();
BehaviorManager bhMgr = new BehaviorManager(this.getCustomBehaviors(), additionalBehaviors);
bhMgr.applyRequestBehaviors(options);

ServiceResponseWithHeaders<PagedList<ApplicationSummary>, ApplicationListHeaders> response = this._parentBatchClient.getProtocolLayer().getApplicationOperations().list(options);
ServiceResponseWithHeaders<PagedList<ApplicationSummaryInner>, ApplicationListHeadersInner> response = this._parentBatchClient.getProtocolLayer().applications().list(options);

return response.getBody();
}

public ApplicationSummary getApplication(String applicationId) throws BatchErrorException, IOException {
public ApplicationSummaryInner getApplication(String applicationId) throws BatchErrorException, IOException {
return getApplication(applicationId, null);
}

public ApplicationSummary getApplication(String applicationId, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
ApplicationGetOptions options = new ApplicationGetOptions();
public ApplicationSummaryInner getApplication(String applicationId, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
ApplicationGetOptionsInner options = new ApplicationGetOptionsInner();
BehaviorManager bhMgr = new BehaviorManager(this.getCustomBehaviors(), additionalBehaviors);
bhMgr.applyRequestBehaviors(options);

ServiceResponseWithHeaders<ApplicationSummary, ApplicationGetHeaders> response = this._parentBatchClient.getProtocolLayer().getApplicationOperations().get(applicationId, options);
ServiceResponseWithHeaders<ApplicationSummaryInner, ApplicationGetHeadersInner> response = this._parentBatchClient.getProtocolLayer().applications().get(applicationId, options);

return response.getBody();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,14 @@

import com.microsoft.azure.batch.auth.BatchSharedKeyCredentials;
import com.microsoft.azure.batch.interceptor.ClientRequestIdInterceptor;
import com.microsoft.azure.batch.protocol.BatchServiceClient;
import com.microsoft.azure.batch.protocol.BatchServiceClientImpl;
import com.microsoft.azure.batch.protocol.implementation.api.BatchServiceClientImpl;

import java.util.Collection;
import java.util.LinkedList;

public class BatchClient {

private BatchServiceClient protocolLayer;
private BatchServiceClientImpl protocolLayer;
private CertificateOperations certificateOperations;
private JobOperations jobOperations;
private TaskOperations taskOperations;
Expand All @@ -28,7 +27,7 @@ public class BatchClient {
private AccountOperations accountOperations;
private Collection<BatchClientBehavior> customBehaviors;

public BatchServiceClient getProtocolLayer() {
public BatchServiceClientImpl getProtocolLayer() {
return this.protocolLayer;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@
package com.microsoft.azure.batch;

import com.microsoft.azure.PagedList;
import com.microsoft.azure.batch.protocol.models.BatchErrorException;
import com.microsoft.azure.batch.protocol.models.Certificate;
import com.microsoft.azure.batch.protocol.models.CertificateAddOptions;
import com.microsoft.azure.batch.protocol.models.CertificateAddParameter;
import com.microsoft.azure.batch.protocol.models.CertificateCancelDeletionOptions;
import com.microsoft.azure.batch.protocol.models.CertificateDeleteOptions;
import com.microsoft.azure.batch.protocol.models.CertificateFormat;
import com.microsoft.azure.batch.protocol.models.CertificateGetHeaders;
import com.microsoft.azure.batch.protocol.models.CertificateGetOptions;
import com.microsoft.azure.batch.protocol.models.CertificateListHeaders;
import com.microsoft.azure.batch.protocol.models.CertificateListOptions;
import com.microsoft.azure.batch.protocol.implementation.api.BatchErrorException;
import com.microsoft.azure.batch.protocol.implementation.api.CertificateInner;
import com.microsoft.azure.batch.protocol.implementation.api.CertificateAddOptionsInner;
import com.microsoft.azure.batch.protocol.implementation.api.CertificateAddParameterInner;
import com.microsoft.azure.batch.protocol.implementation.api.CertificateCancelDeletionOptionsInner;
import com.microsoft.azure.batch.protocol.implementation.api.CertificateDeleteOptionsInner;
import com.microsoft.azure.batch.protocol.implementation.api.CertificateFormat;
import com.microsoft.azure.batch.protocol.implementation.api.CertificateGetHeadersInner;
import com.microsoft.azure.batch.protocol.implementation.api.CertificateGetOptionsInner;
import com.microsoft.azure.batch.protocol.implementation.api.CertificateListHeadersInner;
import com.microsoft.azure.batch.protocol.implementation.api.CertificateListOptionsInner;
import com.microsoft.rest.ServiceResponseWithHeaders;
import org.apache.commons.codec.binary.Base64;

Expand Down Expand Up @@ -86,7 +86,7 @@ public void createCertificate(InputStream certStream, Iterable<BatchClientBehavi
CertificateFactory x509CertFact = CertificateFactory.getInstance("X.509");
X509Certificate cert = (X509Certificate)x509CertFact.generateCertificate(certStream);

CertificateAddParameter addParam = new CertificateAddParameter();
CertificateAddParameterInner addParam = new CertificateAddParameterInner();
addParam.setCertificateFormat(CertificateFormat.CER);
addParam.setThumbprintAlgorithm(SHA1_CERTIFICATE_ALGORITHM);
addParam.setThumbprint(getThumbPrint(cert));
Expand All @@ -98,7 +98,7 @@ public void createCertificate(InputStream certStream, Iterable<BatchClientBehavi
public void createCertificate(InputStream certStream, String password, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException, CertificateException, NoSuchAlgorithmException {
// Need load cert to Keystore first

CertificateAddParameter addParam = new CertificateAddParameter();
CertificateAddParameterInner addParam = new CertificateAddParameterInner();
addParam.setCertificateFormat(CertificateFormat.PFX);
addParam.setThumbprintAlgorithm(SHA1_CERTIFICATE_ALGORITHM);
//addParam.setThumbprint(getThumbPrint(cert));
Expand All @@ -108,76 +108,76 @@ public void createCertificate(InputStream certStream, String password, Iterable<
createCertificate(addParam, additionalBehaviors);
}

public void createCertificate(CertificateAddParameter certificate) throws BatchErrorException, IOException {
public void createCertificate(CertificateAddParameterInner certificate) throws BatchErrorException, IOException {
createCertificate(certificate, null);
}

public void createCertificate(CertificateAddParameter certificate, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
CertificateAddOptions options = new CertificateAddOptions();
public void createCertificate(CertificateAddParameterInner certificate, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
CertificateAddOptionsInner options = new CertificateAddOptionsInner();
BehaviorManager bhMgr = new BehaviorManager(this.getCustomBehaviors(), additionalBehaviors);
bhMgr.applyRequestBehaviors(options);

this._parentBatchClient.getProtocolLayer().getCertificateOperations().add(certificate, options);
this._parentBatchClient.getProtocolLayer().certificates().add(certificate, options);
}

public void cancelDeleteCertificate(String thumbprintAlgorithm, String thumbprint) throws BatchErrorException, IOException {
cancelDeleteCertificate(thumbprintAlgorithm, thumbprint, null);
}

public void cancelDeleteCertificate(String thumbprintAlgorithm, String thumbprint, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
CertificateCancelDeletionOptions options = new CertificateCancelDeletionOptions();
CertificateCancelDeletionOptionsInner options = new CertificateCancelDeletionOptionsInner();
BehaviorManager bhMgr = new BehaviorManager(this.getCustomBehaviors(), additionalBehaviors);
bhMgr.applyRequestBehaviors(options);

this._parentBatchClient.getProtocolLayer().getCertificateOperations().cancelDeletion(thumbprintAlgorithm, thumbprint, options);
this._parentBatchClient.getProtocolLayer().certificates().cancelDeletion(thumbprintAlgorithm, thumbprint, options);
}

public void deleteCertificate(String thumbprintAlgorithm, String thumbprint) throws BatchErrorException, IOException {
deleteCertificate(thumbprintAlgorithm, thumbprint, null);
}

public void deleteCertificate(String thumbprintAlgorithm, String thumbprint, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
CertificateDeleteOptions options = new CertificateDeleteOptions();
CertificateDeleteOptionsInner options = new CertificateDeleteOptionsInner();
BehaviorManager bhMgr = new BehaviorManager(this.getCustomBehaviors(), additionalBehaviors);
bhMgr.applyRequestBehaviors(options);

this._parentBatchClient.getProtocolLayer().getCertificateOperations().delete(thumbprintAlgorithm, thumbprint, options);
this._parentBatchClient.getProtocolLayer().certificates().delete(thumbprintAlgorithm, thumbprint, options);
}

public Certificate getCertificate(String thumbprintAlgorithm, String thumbprint) throws BatchErrorException, IOException {
public CertificateInner getCertificate(String thumbprintAlgorithm, String thumbprint) throws BatchErrorException, IOException {
return getCertificate(thumbprintAlgorithm, thumbprint, null, null);
}

public Certificate getCertificate(String thumbprintAlgorithm, String thumbprint, DetailLevel detailLevel) throws BatchErrorException, IOException {
public CertificateInner getCertificate(String thumbprintAlgorithm, String thumbprint, DetailLevel detailLevel) throws BatchErrorException, IOException {
return getCertificate(thumbprintAlgorithm, thumbprint, detailLevel, null);
}

public Certificate getCertificate(String thumbprintAlgorithm, String thumbprint, DetailLevel detailLevel, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
CertificateGetOptions getCertificateOptions = new CertificateGetOptions();
public CertificateInner getCertificate(String thumbprintAlgorithm, String thumbprint, DetailLevel detailLevel, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
CertificateGetOptionsInner getCertificateOptions = new CertificateGetOptionsInner();
BehaviorManager bhMgr = new BehaviorManager(this.getCustomBehaviors(), additionalBehaviors);
bhMgr.appendDetailLevelToPerCallBehaviors(detailLevel);
bhMgr.applyRequestBehaviors(getCertificateOptions);

ServiceResponseWithHeaders<Certificate, CertificateGetHeaders> response = this._parentBatchClient.getProtocolLayer().getCertificateOperations().get(thumbprintAlgorithm, thumbprint, getCertificateOptions);
ServiceResponseWithHeaders<CertificateInner, CertificateGetHeadersInner> response = this._parentBatchClient.getProtocolLayer().certificates().get(thumbprintAlgorithm, thumbprint, getCertificateOptions);
return response.getBody();
}

public List<Certificate> listCertificates() throws BatchErrorException, IOException {
public List<CertificateInner> listCertificates() throws BatchErrorException, IOException {
return listCertificates(null, null);
}

public List<Certificate> listCertificates(DetailLevel detailLevel) throws BatchErrorException, IOException {
public List<CertificateInner> listCertificates(DetailLevel detailLevel) throws BatchErrorException, IOException {
return listCertificates(detailLevel, null);
}

public List<Certificate> listCertificates(DetailLevel detailLevel, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
public List<CertificateInner> listCertificates(DetailLevel detailLevel, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {

CertificateListOptions certificateListOptions = new CertificateListOptions();
CertificateListOptionsInner certificateListOptions = new CertificateListOptionsInner();
BehaviorManager bhMgr = new BehaviorManager(this.getCustomBehaviors(), additionalBehaviors);
bhMgr.appendDetailLevelToPerCallBehaviors(detailLevel);
bhMgr.applyRequestBehaviors(certificateListOptions);

ServiceResponseWithHeaders<PagedList<Certificate>, CertificateListHeaders> response = this._parentBatchClient.getProtocolLayer().getCertificateOperations().list(certificateListOptions);
ServiceResponseWithHeaders<PagedList<CertificateInner>, CertificateListHeadersInner> response = this._parentBatchClient.getProtocolLayer().certificates().list(certificateListOptions);

return response.getBody();
}
Expand Down
Loading

0 comments on commit 0f8a407

Please sign in to comment.