Permalink
Browse files

change the folder name for adaptor samples, and correct a few inconsi…

…stence
  • Loading branch information...
1 parent 5bb6789 commit 84ddaa9f659e5284dca7be32cc3d604a1bc127b4 ywang19 committed Aug 9, 2013
Showing with 3 additions and 878 deletions.
  1. +3 −2 BUILD.md
  2. +0 −7 adaptor-dev/adaptor/abc-auth/.classpath
  3. +0 −28 adaptor-dev/adaptor/abc-auth/.project
  4. +0 −7 adaptor-dev/adaptor/abc-auth/.settings/org.eclipse.jdt.core.prefs
  5. +0 −22 adaptor-dev/adaptor/abc-auth/META-INF/MANIFEST.MF
  6. +0 −17 adaptor-dev/adaptor/abc-auth/META-INF/spring/plugin-context.xml
  7. +0 −4 adaptor-dev/adaptor/abc-auth/build.properties
  8. +0 −94 adaptor-dev/adaptor/abc-auth/src/com/abc/api/abcAuth/AbcAuth.java
  9. +0 −34 adaptor-dev/adaptor/abc-auth/src/com/abc/api/abcAuth/AbcAuthFactory.java
  10. +0 −84 adaptor-dev/adaptor/abc-auth/src/com/abc/client/abcAuth/AbcAuthClient.java
  11. +0 −50 adaptor-dev/adaptor/abc-auth/src/com/abc/client/abcAuth/AbcAuthClientException.java
  12. +0 −58 adaptor-dev/adaptor/abc-auth/src/com/abc/client/abcAuth/AbcAuthConstants.java
  13. +0 −7 adaptor-dev/adaptor/abc-stor/.classpath
  14. +0 −28 adaptor-dev/adaptor/abc-stor/.project
  15. +0 −7 adaptor-dev/adaptor/abc-stor/.settings/org.eclipse.jdt.core.prefs
  16. +0 −23 adaptor-dev/adaptor/abc-stor/META-INF/MANIFEST.MF
  17. +0 −17 adaptor-dev/adaptor/abc-stor/META-INF/spring/plugin-context.xml
  18. +0 −4 adaptor-dev/adaptor/abc-stor/build.properties
  19. +0 −173 adaptor-dev/adaptor/abc-stor/src/com/abc/api/abcStor/AbcStorage.java
  20. +0 −34 adaptor-dev/adaptor/abc-stor/src/com/abc/api/abcStor/AbcStorageFactory.java
  21. +0 −90 adaptor-dev/adaptor/abc-stor/src/com/abc/client/abcStor/AbcStorClient.java
  22. +0 −50 adaptor-dev/adaptor/abc-stor/src/com/abc/client/abcStor/AbcStorClientException.java
  23. +0 −38 adaptor-dev/adaptor/abc-stor/src/com/abc/client/abcStor/AbcStorConstants.java
  24. BIN adaptor-dev/libs/com.springsource.org.apache.commons.codec-1.3.0.jar
  25. BIN adaptor-dev/libs/org.apache.httpcomponents.httpclient_4.1.3.jar
  26. BIN adaptor-dev/libs/org.apache.httpcomponents.httpcore_4.1.4.jar
View
@@ -3,7 +3,7 @@ Directory structure
${ROOT}
- + adaptor-dev (a sample project for adaptor development)
+ + ext (sample projects for adaptor development)
+ dev (all cosbench plugin projects)
+ dist (all libraries)
+ main (the osgi launcher)
@@ -45,7 +45,8 @@ normally, it's "Running Platform". Selecting "Edit..." button to add required pl
6. Those error signs should disappear, then the development environment is ready.
-7. After applied modifications on one project, just generate the plugins by right clicking the project, and select "export... -> Plug-in Development -> Deployable plugins and fragments", and set the "Directory" to "dist\osgi" folder. Then the plugins libary will be placed at "dist\osgi\plugins" folder.
+7. After applied modifications on one project, just generate the plugins by right clicking the project, and select "export... -> Plug-in Development -> Deployable plugins and fragments",
+and set the "Directory" to "dist\osgi" folder. Then the plugins library will be placed at "dist\osgi\plugins" folder.
8. One script called "pack.cmd" or "pack.sh" could help generate one delivable package by passing it the version number.
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>abc-auth</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
@@ -1,7 +0,0 @@
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
-org.eclipse.jdt.core.compiler.compliance=1.6
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.6
@@ -1,22 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: Abc Auth Client Bundle
-Bundle-SymbolicName: abc-auth
-Bundle-Version: 0.3.0.0
-Bundle-Vendor: Abc Co.
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Import-Package: com.intel.cosbench.api.auth,
- com.intel.cosbench.api.context,
- com.intel.cosbench.client.http,
- com.intel.cosbench.config,
- com.intel.cosbench.log,
- org.apache.commons.codec;version="[1.3.0,2.0.0)",
- org.apache.commons.codec.net;version="[1.3.0,2.0.0)",
- org.apache.http;version="[4.1.4,5.0.0)",
- org.apache.http.client;version="[4.1.3,5.0.0)",
- org.apache.http.client.methods;version="[4.1.3,5.0.0)",
- org.apache.http.conn;version="[4.1.3,5.0.0)",
- org.apache.http.entity;version="[4.1.4,5.0.0)",
- org.apache.http.message;version="[4.1.4,5.0.0)",
- org.apache.http.params;version="[4.1.4,5.0.0)",
- org.apache.http.util;version="[4.1.4,5.0.0)"
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:osgi="http://www.springframework.org/schema/osgi"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
- http://www.springframework.org/schema/osgi
- http://www.springframework.org/schema/osgi/spring-osgi.xsd">
-
- <bean name="authFactory" class="com.abc.api.abcAuth.AbcAuthFactory" />
-
- <osgi:service ref="authFactory" context-class-loader="service-provider"
- interface="com.intel.cosbench.api.auth.AuthAPIFactory">
- </osgi:service>
-
-</beans>
@@ -1,4 +0,0 @@
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .
@@ -1,94 +0,0 @@
-/**
-
-Copyright 2013 Intel Corporation, All Rights Reserved.
-
-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 com.abc.api.abcAuth;
-
-import static com.abc.client.abcAuth.AbcAuthConstants.*;
-
-import java.io.*;
-import java.net.SocketTimeoutException;
-
-import org.apache.http.client.HttpClient;
-
-import com.abc.client.abcAuth.*;
-import com.intel.cosbench.api.auth.*;
-import com.intel.cosbench.api.context.*;
-import com.intel.cosbench.client.http.*;
-import com.intel.cosbench.config.Config;
-import com.intel.cosbench.log.Logger;
-
-public class AbcAuth extends NoneAuth {
-
- private AbcAuthClient client;
-
- private String url;
- private String username;
- private String password;
- private int timeout;
-
- @Override
- public void init(Config config, Logger logger) {
- super.init(config, logger);
- initParms(config);
-
- HttpClient httpClient = HttpClientUtil.createHttpClient(timeout);
- client = new AbcAuthClient(httpClient, url, username, password);
- }
-
- private void initParms(Config config) {
- url = config.get(AUTH_URL_KEY, URL_DEFAULT);
- username = config.get(AUTH_USERNAME_KEY, AUTH_USERNAME_DEFAULT);
- password = config.get(AUTH_PASSWORD_KEY, AUTH_PASSWORD_DEFAULT);
- timeout = config.getInt(CONN_TIMEOUT_KEY, CONN_TIMEOUT_DEFAULT);
-
- parms.put(AUTH_URL_KEY, url);
- parms.put(AUTH_USERNAME_KEY, username);
- parms.put(AUTH_PASSWORD_KEY, password);
- parms.put(CONN_TIMEOUT_KEY, timeout);
-
- logger.debug("using storage config: {}", parms);
- }
-
- @Override
- public void dispose() {
- super.dispose();
- client.dispose();
- }
-
- @Override
- public AuthContext login() {
- super.login();
- try {
- client.login();
- } catch (SocketTimeoutException te) {
- throw new AuthTimeoutException(te);
- } catch (InterruptedIOException ie) {
- throw new AuthInterruptedException(ie);
- } catch (AbcAuthClientException se) {
- throw new AuthException(se.getMessage(), se);
- } catch (Exception e) {
- throw new AuthException(e);
- }
- return createContext();
- }
-
- private AuthContext createContext() {
- AuthContext context = new AuthContext();
- context.put(AUTH_TOKEN_KEY, client.getAuthToken());
- return context;
- }
-}
@@ -1,34 +0,0 @@
-/**
-
-Copyright 2013 Intel Corporation, All Rights Reserved.
-
-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 com.abc.api.abcAuth;
-
-import com.intel.cosbench.api.auth.*;
-
-public class AbcAuthFactory implements AuthAPIFactory {
-
- @Override
- public String getAuthName() {
- return "abcauth";
- }
-
- @Override
- public AuthAPI getAuthAPI() {
- return new AbcAuth();
- }
-
-}
@@ -1,84 +0,0 @@
-/**
-
-Copyright 2013 Intel Corporation, All Rights Reserved.
-
-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 com.abc.client.abcAuth;
-
-import static com.abc.client.abcAuth.AbcAuthConstants.*;
-
-import java.io.*;
-
-import org.apache.http.HttpResponse;
-import org.apache.http.HttpStatus;
-import org.apache.http.client.HttpClient;
-//import org.apache.commons.codec.EncoderException;
-//import org.apache.commons.codec.net.URLCodec;
-//import org.apache.http.*;
-//import org.apache.http.client.methods.*;
-//import org.apache.http.entity.*;
-//import org.apache.http.util.*;
-import org.apache.http.client.methods.HttpGet;
-import org.apache.http.util.EntityUtils;
-
-public class AbcAuthClient {
-
- private String authURL;
- private String username;
- private String password;
-
- private String authToken;
-
- private HttpClient client;
-
- public AbcAuthClient(HttpClient client, String authUrl, String username,
- String password) {
- this.client = client;
- this.authURL = authUrl;
- this.username = username;
- this.password = password;
- }
-
- public String getAuthToken() {
- return authToken;
- }
-
- public void init(String authToken) {
- this.authToken = authToken;
- }
-
- public void dispose() {
- client.getConnectionManager().shutdown();
- }
-
- public void login() throws IOException, AbcAuthClientException {
- HttpResponse response = null;
- try {
- HttpGet method = new HttpGet(authURL);
- method.setHeader(X_STORAGE_USER, username);
- method.setHeader(X_STORAGE_PASS, password);
- response = client.execute(method);
- if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
- authToken = response.getFirstHeader(X_AUTH_TOKEN) != null ? response.getFirstHeader(X_AUTH_TOKEN).getValue() : null;
- return;
- }
- throw new AbcAuthClientException(response.getStatusLine().getStatusCode(), response.getStatusLine().getReasonPhrase());
- } finally {
- if (response != null)
- EntityUtils.consume(response.getEntity());
- }
- }
-
-}
@@ -1,50 +0,0 @@
-/**
-
-Copyright 2013 Intel Corporation, All Rights Reserved.
-
-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 com.abc.client.abcAuth;
-
-import org.apache.http.Header;
-import org.apache.http.StatusLine;
-import org.apache.http.client.HttpResponseException;
-
-
-public class AbcAuthClientException extends HttpResponseException {
- private Header[] httpHeaders;
- private StatusLine httpStatusLine;
-
- public AbcAuthClientException(int code, String message) {
- super(code, message);
- }
-
- public AbcAuthClientException(int code, String message, Header[] httpHeaders,
- StatusLine httpStatusLine) {
- super(code, message);
- this.httpHeaders = httpHeaders;
- this.httpStatusLine = httpStatusLine;
- }
-
- public Header[] getHttpHeaders() {
- return httpHeaders;
- }
-
- public StatusLine getHttpStatusLine() {
- return httpStatusLine;
- }
-
- private static final long serialVersionUID = 1L;
-
-}
Oops, something went wrong.

0 comments on commit 84ddaa9

Please sign in to comment.