diff --git a/messaging/gt4.0-elastic/java/msgbridge/etc/elastic/other/main.conflocator.xml b/messaging/gt4.0-elastic/java/msgbridge/etc/elastic/other/main.conflocator.xml index 9ee01592..81a6bedd 100644 --- a/messaging/gt4.0-elastic/java/msgbridge/etc/elastic/other/main.conflocator.xml +++ b/messaging/gt4.0-elastic/java/msgbridge/etc/elastic/other/main.conflocator.xml @@ -57,10 +57,4 @@ - - - - - diff --git a/messaging/gt4.0-elastic/java/msgbridge/etc/elastic/other/main.xml b/messaging/gt4.0-elastic/java/msgbridge/etc/elastic/other/main.xml index 21484651..2d3def71 100644 --- a/messaging/gt4.0-elastic/java/msgbridge/etc/elastic/other/main.xml +++ b/messaging/gt4.0-elastic/java/msgbridge/etc/elastic/other/main.xml @@ -238,18 +238,6 @@ - - - - - - - - - - diff --git a/messaging/gt4.0/java/gar-builder/build.properties b/messaging/gt4.0/java/gar-builder/build.properties index f06f6fa4..56a53b72 100644 --- a/messaging/gt4.0/java/gar-builder/build.properties +++ b/messaging/gt4.0/java/gar-builder/build.properties @@ -19,7 +19,6 @@ nimbus.authzdbmodule.basedir=${nimbus.basedir}/authzdb nimbus.messaging.gt4_0.basedir=${nimbus.basedir}/messaging/gt4.0/java nimbus.messaging.gt4_0-elastic.basedir=${nimbus.basedir}/messaging/gt4.0-elastic/java nimbus.messaging.query.basedir=${nimbus.basedir}/messaging/query/java/source -nimbus.messaging.rest.basedir=${nimbus.basedir}/messaging/rest/java/source nimbus.metadata-server.basedir=${nimbus.basedir}/metadata/java/source ########################################## @@ -59,7 +58,6 @@ nimbus.messaging.gt4_0.gar.build.packages.xml=../../../../scripts/lib/gt4.0/buil nimbus.service.main.etc.dir=${nimbus.service.main.basedir}/etc nimbus.messaging.gt4_0-elastic.etc.dir=${nimbus.messaging.gt4_0-elastic.basedir}/msgbridge/etc nimbus.messaging.query.etc.dir=${nimbus.messaging.query.basedir}/etc -nimbus.messaging.rest.etc.dir=${nimbus.messaging.rest.basedir}/etc nimbus.messaging.gt4_0.gar.etc.dir=etc @@ -83,7 +81,6 @@ nimbus.messaging.gt4_0.common.dist.dir=${nimbus.messaging.gt4_0.basedir}/common/ nimbus.messaging.gt4_0.msgbridge.dist.dir=${nimbus.messaging.gt4_0.basedir}/msgbridge/dist/ nimbus.messaging.gt4_0-elastic.msgbridge.dist.dir=${nimbus.messaging.gt4_0-elastic.basedir}/msgbridge/dist/ nimbus.messaging.query.dist.dir=${nimbus.messaging.query.basedir}/dist/ -nimbus.messaging.rest.dist.dir=${nimbus.messaging.rest.basedir}/dist/ # you can override this in ~/nimbus.build.properties nimbus.java.compilerarg=-nowarn diff --git a/messaging/gt4.0/java/gar-builder/build.xml b/messaging/gt4.0/java/gar-builder/build.xml index 19151a8d..a7310b4d 100644 --- a/messaging/gt4.0/java/gar-builder/build.xml +++ b/messaging/gt4.0/java/gar-builder/build.xml @@ -136,10 +136,6 @@ - - - - @@ -158,9 +154,6 @@ - - - diff --git a/messaging/gt4.0/java/gar-builder/etc/post-deploy.xml b/messaging/gt4.0/java/gar-builder/etc/post-deploy.xml index 29a5542e..e679d070 100644 --- a/messaging/gt4.0/java/gar-builder/etc/post-deploy.xml +++ b/messaging/gt4.0/java/gar-builder/etc/post-deploy.xml @@ -26,9 +26,6 @@ - - diff --git a/messaging/rest/java/source/build.properties b/messaging/rest/java/source/build.properties deleted file mode 100644 index 47b084d0..00000000 --- a/messaging/rest/java/source/build.properties +++ /dev/null @@ -1,20 +0,0 @@ -nimbus.messaging.rest.print-noun=Nimbus CXF REST Admin Interface - -nimbus.messaging.rest.build.dir=build -nimbus.messaging.rest.build.dest=build/classes -nimbus.messaging.rest.src.dir=src -nimbus.messaging.rest.dist.dir=dist -nimbus.messaging.rest.jar.name=nimbus-messaging-rest.jar - -nimbus.messaging.rest.testserver.keystore.dest=build/testkeystore.jks -nimbus.messaging.rest.testserver.keystore.pass=thisisonlyatest. - -nimbus.messaging.rest.lib.dir=../../../../lib/services - -# Dependencies from source tree -nimbus.autocommon.dist.dir=../../../../autocommon/dist - -# you can override this in ~/nimbus.build.properties -nimbus.java.compilerarg=-nowarn - - diff --git a/messaging/rest/java/source/build.xml b/messaging/rest/java/source/build.xml deleted file mode 100644 index f8fb1fe1..00000000 --- a/messaging/rest/java/source/build.xml +++ /dev/null @@ -1,159 +0,0 @@ - - - - - Nimbus CXF REST Admin Interface - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Building: ${nimbus.messaging.rest.print-noun} - - Built: ${nimbus.messaging.rest.print-noun} - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/messaging/rest/java/source/etc/rest/other/main-fake.xml b/messaging/rest/java/source/etc/rest/other/main-fake.xml deleted file mode 100644 index e0d3a9fb..00000000 --- a/messaging/rest/java/source/etc/rest/other/main-fake.xml +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/messaging/rest/java/source/etc/rest/other/main.conflocator.xml b/messaging/rest/java/source/etc/rest/other/main.conflocator.xml deleted file mode 100644 index 8a0ea8a3..00000000 --- a/messaging/rest/java/source/etc/rest/other/main.conflocator.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - diff --git a/messaging/rest/java/source/etc/rest/other/main.xml b/messaging/rest/java/source/etc/rest/other/main.xml deleted file mode 100644 index ed827bf7..00000000 --- a/messaging/rest/java/source/etc/rest/other/main.xml +++ /dev/null @@ -1,86 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/messaging/rest/java/source/etc/rest/rest.conf b/messaging/rest/java/source/etc/rest/rest.conf deleted file mode 100644 index 051038f4..00000000 --- a/messaging/rest/java/source/etc/rest/rest.conf +++ /dev/null @@ -1,12 +0,0 @@ -rest.enabled=false -rest.port=4443 - -keystore.path=$NIMBUS_HOME/var/keystore.jks -keystore.password=secrets - -gridmap.path=file:///path/to/grid-mapfile -groupauthz.path= -query.usermap.path=$NIMBUS_HOME/services/etc/nimbus/query/users.txt -gridmap.localuser=cloudimages - -rest.spring.path=$NIMBUS_HOME/services/etc/nimbus/rest/other/main.xml diff --git a/messaging/rest/java/source/src/org/nimbustools/messaging/rest/AdminResource.java b/messaging/rest/java/source/src/org/nimbustools/messaging/rest/AdminResource.java deleted file mode 100644 index 403fdc36..00000000 --- a/messaging/rest/java/source/src/org/nimbustools/messaging/rest/AdminResource.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 1999-2009 University of Chicago - * - * 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 org.nimbustools.messaging.rest; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import static org.nimbustools.messaging.rest.ResponseUtil.JSON_CONTENT_TYPE; -import org.nimbustools.messaging.rest.repr.User; -import org.springframework.beans.factory.InitializingBean; - -import javax.ws.rs.Path; -import javax.ws.rs.GET; -import javax.ws.rs.Produces; -import javax.ws.rs.core.Response; - -@Path("/admin/") -public class AdminResource implements InitializingBean { - - private static final Log logger = - LogFactory.getLog(AdminResource.class.getName()); - - //sub-resources - private UsersResource usersResource; - - - private ResponseUtil responseUtil; - - - // subresources have annotated getters - - @Path("/users") - public UsersResource getUsersResource() { - return this.usersResource; - } - - public void setUsersResource(UsersResource usersResource) { - this.usersResource = usersResource; - } - - public ResponseUtil getResponseUtil() { - return responseUtil; - } - - public void setResponseUtil(ResponseUtil responseUtil) { - this.responseUtil = responseUtil; - } - - public void afterPropertiesSet() throws Exception { - if (responseUtil == null) { - throw new IllegalArgumentException("responseUtil may not be null"); - } - - if (usersResource == null) { - throw new IllegalArgumentException("usersResource may not be null"); - } - } -} diff --git a/messaging/rest/java/source/src/org/nimbustools/messaging/rest/DuplicateUserException.java b/messaging/rest/java/source/src/org/nimbustools/messaging/rest/DuplicateUserException.java deleted file mode 100644 index 7eaa0b5b..00000000 --- a/messaging/rest/java/source/src/org/nimbustools/messaging/rest/DuplicateUserException.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 1999-2009 University of Chicago - * - * 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 org.nimbustools.messaging.rest; - -public class DuplicateUserException extends Exception { - public DuplicateUserException(String message) { - super(message); - } - - public DuplicateUserException(String message, Throwable cause) { - super(message, cause); - } - - public DuplicateUserException(Throwable cause) { - super(cause); - } -} diff --git a/messaging/rest/java/source/src/org/nimbustools/messaging/rest/FakeUsersService.java b/messaging/rest/java/source/src/org/nimbustools/messaging/rest/FakeUsersService.java deleted file mode 100644 index 88dea803..00000000 --- a/messaging/rest/java/source/src/org/nimbustools/messaging/rest/FakeUsersService.java +++ /dev/null @@ -1,89 +0,0 @@ -package org.nimbustools.messaging.rest;/* - * Copyright 1999-2009 University of Chicago - * - * 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. - */ - -import org.nimbustools.messaging.rest.UsersService; -import org.nimbustools.messaging.rest.UnknownKeyException; -import org.nimbustools.messaging.rest.repr.User; -import org.nimbustools.messaging.rest.repr.AccessKey; -import org.springframework.security.core.codec.Base64; -import org.joda.time.DateTime; - -import javax.crypto.KeyGenerator; -import javax.crypto.SecretKey; -import java.util.List; -import java.util.HashMap; -import java.util.ArrayList; -import java.util.UUID; -import java.security.NoSuchAlgorithmException; - -public class FakeUsersService implements UsersService { - - HashMap users = new HashMap(); - HashMap keys = new HashMap(); - - public List getUsers() { - return new ArrayList(users.values()); - } - - public User getUserById(String id) throws UnknownUserException { - final User user = users.get(id); - - if (user == null) { - throw new UnknownUserException(); - } - return user; - } - - public User addUser(User user) { - - user.setId(UUID.randomUUID().toString()); - - users.put(user.getId(), user); - return user; - } - - public AccessKey getAccessKey(User user) throws UnknownKeyException { - AccessKey key = keys.get(user.getId()); - if (key == null) { - throw new UnknownKeyException(); - } - return key; - } - - public AccessKey createAccessKey(User user) { - final KeyGenerator keyGen; - try { - keyGen = KeyGenerator.getInstance("HmacSHA1"); - } catch (NoSuchAlgorithmException e) { - throw new RuntimeException(e); - } - keyGen.init(256); - final SecretKey key = keyGen.generateKey(); - - final String secret = new String(Base64.encode(key.getEncoded())); - - AccessKey accessKey = new AccessKey(); - accessKey.setKey(user.getId()); - accessKey.setSecret(secret); - accessKey.setEnabled(true); - accessKey.setCreationTime(new DateTime()); - - keys.put(user.getId(), accessKey); - - return accessKey; - } - -} diff --git a/messaging/rest/java/source/src/org/nimbustools/messaging/rest/GridmapUsersService.java b/messaging/rest/java/source/src/org/nimbustools/messaging/rest/GridmapUsersService.java deleted file mode 100644 index 6452df6b..00000000 --- a/messaging/rest/java/source/src/org/nimbustools/messaging/rest/GridmapUsersService.java +++ /dev/null @@ -1,421 +0,0 @@ -/* - * Copyright 1999-2010 University of Chicago - * - * 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 org.nimbustools.messaging.rest; - -import org.nimbustools.messaging.rest.repr.User; -import org.nimbustools.messaging.rest.repr.AccessKey; -import org.nimbustools.auto_common.ezpz_ca.HashUtil; -import org.springframework.core.io.Resource; -import org.springframework.beans.factory.InitializingBean; -import org.springframework.security.core.codec.Base64; -import org.mortbay.util.QuotedStringTokenizer; - -import javax.crypto.KeyGenerator; -import javax.crypto.SecretKey; -import java.util.*; -import java.io.*; -import java.security.NoSuchAlgorithmException; - -public class GridmapUsersService implements UsersService, InitializingBean { - - private static final String DEFAULT_LOCAL_USERNAME = "not_a_real_user"; - - private final Object lock = new Object(); - - private String localUserName; - - private Resource gridmapResource; - private Resource groupAuthzResource; - private Resource queryUsersResource; - - private TokenizedFile gridmap; - private TokenizedFile queryUsers; - - /** - * Retrieve a list of all users - * - * @return List of users - */ - public List getUsers() { - - List users = new ArrayList(); - - synchronized (this.lock) { - refreshIfNeeded(gridmap); - for (String[] line : this.gridmap.getLines()) { - String dn = line[0]; - String lineId = getUserId(dn); - - User user = new User(); - user.setId(lineId); - user.setDn(dn); - users.add(user); - } - } - return users; - } - - /** - * Retrieve a specific user by ID - * - * @param id ID of user to retrieve - * @return The user - * @throws UnknownUserException - * A user with specified ID does not exist - */ - public User getUserById(String id) throws UnknownUserException { - - synchronized (this.lock) { - refreshIfNeeded(gridmap); - String[] line = gridmap.getLinesMap().get(id); - if (line == null) { - throw new UnknownUserException(); - } - User user = new User(); - user.setId(id); - user.setDn(line[0]); - return user; - } - } - - private void refreshIfNeeded(TokenizedFile file) { - try { - file.refreshIfNeeded(); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - /** - * Add a new user - * - * @param user The user - * @return The new user, with ID - * @throws DuplicateUserException - * User already exists - */ - public User addUser(User user) throws DuplicateUserException { - - String dn = user.getDn().trim(); - final String userId = getUserId(dn); - - synchronized (this.lock) { - if (gridmap.getLinesMap().containsKey(userId)) { - throw new DuplicateUserException("DN '"+dn+ - "' already exists in gridmap"); - } - - final String gridmapLine = "\""+ dn +"\" " + this.localUserName; - appendLineToResource(gridmapResource, gridmapLine); - if (groupAuthzResource != null) { - appendLineToResource(groupAuthzResource, gridmapLine); - } - } - - user = new User(); - user.setDn(dn); - user.setId(userId); - return user; - } - - private static void appendLineToResource(Resource resource, String line) { - try { - final File file = resource.getFile(); - FileOutputStream f = new FileOutputStream(file, true); - OutputStreamWriter writer = new OutputStreamWriter(f); - writer.write(line+"\n"); - writer.close(); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - /** - * Retrieve the access key for a user - * - * @param user The user - * @return The access key - * @throws UnknownKeyException - * User does not have an access key - */ - public AccessKey getAccessKey(User user) - throws UnknownKeyException { - - if (user == null) { - throw new IllegalArgumentException("user may not be null"); - } - - final String userId = user.getId(); - - if (userId == null) { - throw new IllegalArgumentException("user's ID may not be null"); - } - - synchronized (this.lock) { - final String[] line = this.queryUsers.getLinesMap().get(userId); - if (line == null) { - throw new UnknownKeyException(); - } - if (line.length < 3) { - throw new UnknownKeyException(); - } - AccessKey accessKey = new AccessKey(); - accessKey.setKey(line[1]); - accessKey.setSecret(line[2]); //uhhhhh - accessKey.setEnabled(true); - return accessKey; - } - } - - /** - * Creates an access key for user. If a key exists, it will - * be discarded and replaced with a new one. - * - * @param user The user - * @return New access key - */ - public AccessKey createAccessKey(User user) { - - if (user == null) { - throw new IllegalArgumentException("user may not be null"); - } - - final String dn = user.getDn(); - - if (dn == null) { - throw new IllegalArgumentException("user's DN may not be null"); - } - - final String accessId; - try { - accessId = getHashUtil().hashDN(dn); - } catch (NoSuchAlgorithmException e) { - throw new RuntimeException(e); - } - final String secret = generateSecretKey(); - - final String line = "\""+dn+"\" "+accessId+" "+secret; - - appendLineToResource(this.queryUsersResource, line); - - AccessKey accessKey = new AccessKey(); - accessKey.setEnabled(true); - accessKey.setKey(accessId); - accessKey.setSecret(secret); - return accessKey; - } - - private String generateSecretKey() { - final KeyGenerator keyGen; - try { - keyGen = KeyGenerator.getInstance("HmacSHA1"); - } catch (NoSuchAlgorithmException e) { - throw new RuntimeException(e); - } - keyGen.init(256); - final SecretKey key = keyGen.generateKey(); - return new String(Base64.encode(key.getEncoded())); - } - - public void initialize() throws Exception { - this.gridmap = new TokenizedFile(this.gridmapResource.getFile()); - this.gridmap.refreshIfNeeded(); - this.queryUsers = new TokenizedFile(this.queryUsersResource.getFile()); - this.queryUsers.refreshIfNeeded(); - - if (this.groupAuthzResource != null) { - if (!this.groupAuthzResource.exists()) { - throw new Exception( - "groupAuthz file resource specified doesn't exist: "+ - groupAuthzResource.getFilename()); - } - } - } - - public Resource getGridmapResource() { - return gridmapResource; - } - - public void setGridmapResource(Resource gridmapResource) { - this.gridmapResource = gridmapResource; - } - - public Resource getGroupAuthzResource() { - return groupAuthzResource; - } - - public void setGroupAuthzResource(Resource groupAuthzResource) { - this.groupAuthzResource = groupAuthzResource; - } - - public Resource getQueryUsersResource() { - return queryUsersResource; - } - - public void setQueryUsersResource(Resource queryUsersResource) { - this.queryUsersResource = queryUsersResource; - } - - public String getLocalUserName() { - return localUserName; - } - - public void setLocalUserName(String localUserName) { - this.localUserName = localUserName; - } - - public void afterPropertiesSet() throws Exception { - if (this.gridmapResource == null) { - throw new IllegalArgumentException("this.gridmapResource may not be null"); - } - if (this.queryUsersResource == null) { - throw new IllegalArgumentException("this.queryUsersResource may not be null"); - } - - if (this.localUserName == null || this.localUserName.trim().length() == 0) { - this.localUserName = DEFAULT_LOCAL_USERNAME; - } - - this.initialize(); - } - - static String getUserId(String dn) { - return getUserId(dn, getHashUtil()); - } - - static String getUserId(String dn, HashUtil hashUtil) { - try { - return "0-"+hashUtil.hashDN(dn); - } catch (NoSuchAlgorithmException e) { - throw new RuntimeException(e); - } - } - - static HashUtil getHashUtil() { - final HashUtil hashUtil; - try { - hashUtil = new HashUtil(); - } catch (NoSuchAlgorithmException e) { - throw new RuntimeException(e); - } - return hashUtil; - } - - /** - * Works with a special file format: DN followed by zero or more - * additional fields, delimited by whitespace. - * Gridmap or query users files, for example. The DN is hashed - * into a user ID for quick lookups. - */ - private static class TokenizedFile { - - private static final String DELIMS = " \t\n\r\f"; - - final File file; - private long lastModified; - - final List list; - final Map map; - - public TokenizedFile(File file) { - if (file == null) { - throw new IllegalArgumentException("file may not be null"); - } - this.file = file; - - this.list = new ArrayList(); - this.map = new HashMap(); - } - - public boolean refreshIfNeeded() throws IOException { - if (this.file.lastModified() > this.lastModified) { - load(this.file); - return true; - } - return false; - } - - public List getLines() { - return this.list; - } - - public Map getLinesMap() { - return this.map; - } - - private void load(File file) throws IOException { - - if (file == null) { - throw new IllegalArgumentException("file may not be null"); - } - - InputStream in = null; - try { - in = new FileInputStream(file); - this.lastModified = file.lastModified(); - load(in); - } finally { - if (in != null) { - try { in.close(); } - catch(Exception ignored) { - } - } - } - } - - private void load(InputStream stream) throws IOException { - final BufferedReader reader = - new BufferedReader(new InputStreamReader(stream)); - - this.list.clear(); - this.map.clear(); - - final HashUtil hashUtil = GridmapUsersService.getHashUtil(); - - String line; - final List tokens = new ArrayList(); - while ((line = reader.readLine()) != null) { - tokens.clear(); - line = line.trim(); - - if (line.length() == 0 || line.charAt(0) == '#') { - continue; - } - - final QuotedStringTokenizer tokenizer = - new QuotedStringTokenizer(line, DELIMS); - - try { - while (tokenizer.hasMoreTokens()) { - tokens.add(tokenizer.nextToken()); - } - - } catch (NoSuchElementException e) { - continue; - } - - String[] tokensArray = new String[tokens.size()]; - tokensArray = tokens.toArray(tokensArray); - - String userId = GridmapUsersService.getUserId( - tokensArray[0], hashUtil); - - this.list.add(tokensArray); - this.map.put(userId, tokensArray); - } - } - } -} diff --git a/messaging/rest/java/source/src/org/nimbustools/messaging/rest/NimbusWebException.java b/messaging/rest/java/source/src/org/nimbustools/messaging/rest/NimbusWebException.java deleted file mode 100644 index 9920743c..00000000 --- a/messaging/rest/java/source/src/org/nimbustools/messaging/rest/NimbusWebException.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 1999-2009 University of Chicago - * - * 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 org.nimbustools.messaging.rest; - -import javax.ws.rs.core.Response; -import java.util.UUID; - -public class NimbusWebException extends RuntimeException { - - private final int status; - private final String requestId; - - public NimbusWebException(Response.Status status, String msg, Throwable t) { - super(msg, t); - - if (status == null) { - throw new IllegalArgumentException("status may not be null"); - } - - this.status = status.getStatusCode(); - this.requestId = UUID.randomUUID().toString(); - } - - public NimbusWebException(int status, String msg, Throwable t) { - - super(msg, t); - - this.status = status; - this.requestId = UUID.randomUUID().toString(); - } - - public NimbusWebException(String msg, Throwable t) { - this(400, msg, t); - } - - public NimbusWebException(String msg) { - this(400, msg, null); - } - - public int getStatus() { - return status; - } - - public String getRequestId() { - return requestId; - } -} diff --git a/messaging/rest/java/source/src/org/nimbustools/messaging/rest/NimbusWebExceptionMapper.java b/messaging/rest/java/source/src/org/nimbustools/messaging/rest/NimbusWebExceptionMapper.java deleted file mode 100644 index 01ccce54..00000000 --- a/messaging/rest/java/source/src/org/nimbustools/messaging/rest/NimbusWebExceptionMapper.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright 1999-2009 University of Chicago - * - * 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 org.nimbustools.messaging.rest; - -import org.nimbustools.messaging.rest.repr.ErrorMessage; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.beans.factory.InitializingBean; - -import javax.ws.rs.ext.ExceptionMapper; -import javax.ws.rs.core.Response; - -public class NimbusWebExceptionMapper - implements ExceptionMapper, InitializingBean { - - private static final Log logger = - LogFactory.getLog(NimbusWebExceptionMapper.class.getName()); - - private ResponseUtil responseUtil; - - public Response toResponse(NimbusWebException e) { - - final ErrorMessage err = new ErrorMessage(e.getMessage(), e.getRequestId()); - - int statusCode = e.getStatus(); - final Response.Status status; - if (statusCode >= 400 && statusCode < 600) { - // client expects 4xx for request error or 5xx for server error. - // anything else is not an error response - status = Response.Status.fromStatusCode(statusCode); - } else { - status = Response.Status.BAD_REQUEST; - } - - logger.debug("Mapping exception to error response. RequestId="+ - e.getRequestId(), e); - - return responseUtil.createErrorResponse(err, status); - } - - public ResponseUtil getResponseUtil() { - return responseUtil; - } - - public void setResponseUtil(ResponseUtil responseUtil) { - this.responseUtil = responseUtil; - } - - public void afterPropertiesSet() throws Exception { - if (responseUtil == null) { - throw new IllegalArgumentException("responseUtil may not be null"); - } - } -} diff --git a/messaging/rest/java/source/src/org/nimbustools/messaging/rest/OutFaultInterceptor.java b/messaging/rest/java/source/src/org/nimbustools/messaging/rest/OutFaultInterceptor.java deleted file mode 100644 index 1c9d9728..00000000 --- a/messaging/rest/java/source/src/org/nimbustools/messaging/rest/OutFaultInterceptor.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Copyright 1999-2009 University of Chicago - * - * 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 org.nimbustools.messaging.rest; - -import java.io.IOException; -import java.util.UUID; - -import javax.servlet.http.HttpServletResponse; - -import org.apache.cxf.interceptor.Fault; -import org.apache.cxf.message.Message; -import org.apache.cxf.phase.AbstractPhaseInterceptor; -import org.apache.cxf.phase.Phase; -import org.apache.cxf.transport.http.AbstractHTTPDestination; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.nimbustools.messaging.rest.repr.ErrorMessage; -import org.springframework.beans.factory.InitializingBean; - - -public class OutFaultInterceptor - extends AbstractPhaseInterceptor - implements InitializingBean { - - private static final String ERROR_TEXT = "An internal server error occurred. Please " + - "contact the administer and include the request ID."; - - private static final Log logger = - LogFactory.getLog(OutFaultInterceptor.class.getName()); - - private boolean handleMessageCalled; - private ResponseUtil responseUtil; - - public OutFaultInterceptor() { - this(Phase.PRE_STREAM); - } - - public OutFaultInterceptor(String s) { - super(Phase.MARSHAL); - - } - - @SuppressWarnings({"ThrowableResultOfMethodCallIgnored"}) - public void handleMessage(Message message) throws Fault { - handleMessageCalled = true; - Exception ex = message.getContent(Exception.class); - if (ex == null) { - throw new RuntimeException("Exception is expected"); - } - Fault fault = (Fault)ex; - - final Throwable t = fault.getCause(); - - ErrorMessage error; - int status; - - // note that these exceptions are probably handled by NimbusWebExceptionMapper. - // leaving this logic in case that is disabled.. - if (t instanceof NimbusWebException) { - NimbusWebException nwe = (NimbusWebException) t; - - String errorText = nwe.getMessage(); - if (errorText == null) { - errorText = ERROR_TEXT; - } - - String requestId = nwe.getRequestId(); - if (requestId == null) { - requestId = UUID.randomUUID().toString(); - } - - error = new ErrorMessage(errorText, requestId); - - status = nwe.getStatus(); - if (status < 400 || status >= 600) { - // client expects a 4xx response for request error - // or 5xx for server error. otherwise success.. - status = 500; - } - - logger.debug("Returning friendly error response for exception. " + - "RequestID: "+requestId, nwe); - - } else { - - // otherwise it is some unhandled error condition; - // likely a bug somewhere. - - String requestId = UUID.randomUUID().toString(); - - error = new ErrorMessage(ERROR_TEXT, requestId); - status = 500; - - logger.error("Caught unhandled exception! This may be a bug. " + - "RequestID: "+requestId, t); - } - - // deal with the actual exception : fault.getCause() - HttpServletResponse response = (HttpServletResponse)message.getExchange() - .getInMessage().get(AbstractHTTPDestination.HTTP_RESPONSE); - response.setStatus(status); - response.setContentType(ResponseUtil.JSON_CONTENT_TYPE); - try { - - final String s = responseUtil.createJsonString(error); - - - response.getOutputStream().write(s.getBytes()); - response.getOutputStream().flush(); - message.getInterceptorChain().abort(); - } catch (IOException ioex) { - throw new RuntimeException("Error writing the response"); - } - } - - protected boolean handleMessageCalled() { - return handleMessageCalled; - } - - public ResponseUtil getResponseUtil() { - return responseUtil; - } - - public void setResponseUtil(ResponseUtil responseUtil) { - this.responseUtil = responseUtil; - } - - public void afterPropertiesSet() throws Exception { - if (responseUtil == null) { - throw new IllegalArgumentException("responseUtil may not be null"); - } - } -} - diff --git a/messaging/rest/java/source/src/org/nimbustools/messaging/rest/ResponseUtil.java b/messaging/rest/java/source/src/org/nimbustools/messaging/rest/ResponseUtil.java deleted file mode 100644 index 610cc455..00000000 --- a/messaging/rest/java/source/src/org/nimbustools/messaging/rest/ResponseUtil.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright 1999-2009 University of Chicago - * - * 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 org.nimbustools.messaging.rest; - -import com.google.gson.*; - -import javax.ws.rs.core.Response; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.nimbustools.messaging.rest.repr.ErrorMessage; -import org.joda.time.DateTime; - -import java.net.URI; -import java.lang.reflect.Type; -import java.util.Date; - -public class ResponseUtil { - - public static final String JSON_CONTENT_TYPE = "application/json"; - - private static final Log logger = - LogFactory.getLog(ResponseUtil.class.getName()); - - final Gson gson; - - public ResponseUtil() { - final GsonBuilder gsonBuilder = new GsonBuilder(); - - gsonBuilder.registerTypeAdapter(DateTime.class, - new DateTimeTypeConverter()); - - this.gson = gsonBuilder.create(); - } - - public Response createJsonResponse(Object obj) { - - if (obj == null) { - throw new IllegalArgumentException("obj may not be null"); - } - final String json = gson.toJson(obj); - - return Response.ok(json, JSON_CONTENT_TYPE).build(); - } - - public String createJsonString(Object obj) { - if (obj == null) { - throw new IllegalArgumentException("obj may not be null"); - } - - return gson.toJson(obj); - } - - public Response createServerErrorResponse() { - return Response.serverError().build(); - } - - public Response createErrorResponse(ErrorMessage error, Response.Status status) { - - if (error == null) { - throw new IllegalArgumentException("error may not be null"); - } - - final String json = this.gson.toJson(error); - - return Response.status(status).entity(json).build(); - } - - public Response createCreatedResponse(URI uri, Object body) { - if (uri == null) { - throw new IllegalArgumentException("uri may not be null"); - } - - - final Response.ResponseBuilder builder = Response.created(uri); - if (body != null) { - builder.entity(createJsonString(body)); - builder.type(JSON_CONTENT_TYPE); - } - return builder.build(); - } - - public T fromJson(String json, Class classOfT) { - try { - return gson.fromJson(json, classOfT); - } catch (Exception e) { - throw new NimbusWebException("Failed to parse JSON message as a "+ - classOfT.getSimpleName(), e); - } - } - - // sample JodaTime adapter from: - // http://sites.google.com/site/gson/gson-type-adapters-for-common-classes-1 - private static class DateTimeTypeConverter - implements JsonSerializer, JsonDeserializer { - public JsonElement serialize(DateTime src, Type srcType, JsonSerializationContext context) { - return new JsonPrimitive(src.toString()); - } - - public DateTime deserialize(JsonElement json, Type type, JsonDeserializationContext context) - throws JsonParseException { - try { - return new DateTime(json.getAsString()); - } catch (IllegalArgumentException e) { - // May be it came in formatted as a java.util.Date, so try that - Date date = context.deserialize(json, Date.class); - return new DateTime(date); - } - } - } - - -} diff --git a/messaging/rest/java/source/src/org/nimbustools/messaging/rest/RestHttp.java b/messaging/rest/java/source/src/org/nimbustools/messaging/rest/RestHttp.java deleted file mode 100644 index fd3bc7b3..00000000 --- a/messaging/rest/java/source/src/org/nimbustools/messaging/rest/RestHttp.java +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Copyright 1999-2010 University of Chicago - * - * 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 org.nimbustools.messaging.rest; - -import org.mortbay.jetty.Server; -import org.mortbay.jetty.Connector; -import org.mortbay.jetty.Handler; -import org.mortbay.jetty.webapp.WebAppContext; -import org.mortbay.jetty.servlet.Context; -import org.mortbay.jetty.servlet.FilterHolder; -import org.mortbay.jetty.servlet.ServletHolder; -import org.mortbay.jetty.security.SslSocketConnector; -import org.springframework.core.io.Resource; -import org.springframework.web.context.ContextLoaderListener; -import org.springframework.web.filter.DelegatingFilterProxy; -import org.apache.cxf.transport.servlet.CXFServlet; - -import java.io.IOException; -import java.util.Map; -import java.util.HashMap; - -public class RestHttp { - - private boolean enabled; - - private int port; - private String springConfig; - private String keystoreLocation; - private String keystorePassword; - private Server server; - - public RestHttp() {} - - public RestHttp(String springConfig, int port, - String keystoreLocation, String keystorePassword) { - this.port = port; - this.springConfig = springConfig; - this.keystoreLocation = keystoreLocation; - this.keystorePassword = keystorePassword; - } - - public synchronized void startListening() throws Exception { - - if (!enabled) { - return; - } - - if (port <= 0) { - throw new IllegalStateException("port is invalid"); - } - if (springConfig == null) { - throw new IllegalStateException("springConfig may not be null"); - } - - if (keystoreLocation == null) { - throw new IllegalStateException("keystoreLocation may not be null"); - } - - if (keystorePassword == null) { - throw new IllegalStateException("keystorePassword may not be null"); - } - - - server = new Server(); - - SslSocketConnector sslConnector = new SslSocketConnector(); - sslConnector.setPort(port); - sslConnector.setKeystore(keystoreLocation); - sslConnector.setKeyPassword(keystorePassword); - sslConnector.setPassword(keystorePassword); - sslConnector.setTruststore(keystoreLocation); - sslConnector.setTrustPassword(keystorePassword); - server.setConnectors(new Connector[] {sslConnector}); - - Context context = new Context(server, "/", Context.SESSIONS); - Map initParams = new HashMap(); - initParams.put("contextConfigLocation", springConfig); - context.setInitParams(initParams); - context.addEventListener(new ContextLoaderListener()); - FilterHolder filterHolder = new FilterHolder(new DelegatingFilterProxy()); - filterHolder.setName("springSecurityFilterChain"); - context.addFilter(filterHolder, "/*", Handler.DEFAULT); - ServletHolder servletHolder = new ServletHolder(new CXFServlet()); - servletHolder.setInitOrder(1); - servletHolder.setName("CXFServlet"); - servletHolder.setDisplayName("CXF Servlet"); - context.addServlet(servletHolder, "/*"); - WebAppContext webappcontext = new WebAppContext(); - webappcontext.setContextPath("/"); - server.start(); - } - - public boolean isEnabled() { - return enabled; - } - - public void setEnabled(boolean enabled) { - this.enabled = enabled; - } - - public int getPort() { - return port; - } - - public void setPort(int port) { - this.port = port; - } - - public void setSpringConfigResource(Resource springConfigResource) throws IOException { - this.springConfig = springConfigResource.getFile().getAbsolutePath(); - } - - public void setKeystoreResource(Resource keystoreResource) throws IOException { - this.keystoreLocation = keystoreResource.getFile().getAbsolutePath(); - } - - public String getKeystorePassword() { - return keystorePassword; - } - - public void setKeystorePassword(String keystorePassword) { - this.keystorePassword = keystorePassword; - } - - public Server getServer() { - return server; - } - - public static void main(String[] args) { - - if (args.length != 4) { - System.err.println("Needs these arguments:\n"+ - "\tspring config path (absolute)\n"+ - "\tport\n"+ - "\tkeystore path\n" + - "\tkeystore password\n"); - System.exit(1); - } - - String springPath = "file://"+args[0]; - int port = Integer.parseInt(args[1]); - String keystorePath = args[2]; - String keystorePass = args[3]; - - RestHttp http = new RestHttp(springPath, port, - keystorePath, keystorePass); - http.setEnabled(true); - - try { - http.startListening(); - http.server.join(); - } catch (Exception e) { - System.err.println("Error running REST http server:"); - e.printStackTrace(); - System.exit(1); - } - - } - -} diff --git a/messaging/rest/java/source/src/org/nimbustools/messaging/rest/UnknownKeyException.java b/messaging/rest/java/source/src/org/nimbustools/messaging/rest/UnknownKeyException.java deleted file mode 100644 index 7cdc585c..00000000 --- a/messaging/rest/java/source/src/org/nimbustools/messaging/rest/UnknownKeyException.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 1999-2009 University of Chicago - * - * 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 org.nimbustools.messaging.rest; - -public class UnknownKeyException extends Exception { - public UnknownKeyException() { - } - - public UnknownKeyException(String message) { - super(message); - } - - public UnknownKeyException(String message, Throwable cause) { - super(message, cause); - } -} diff --git a/messaging/rest/java/source/src/org/nimbustools/messaging/rest/UnknownUserException.java b/messaging/rest/java/source/src/org/nimbustools/messaging/rest/UnknownUserException.java deleted file mode 100644 index 8b36c4b0..00000000 --- a/messaging/rest/java/source/src/org/nimbustools/messaging/rest/UnknownUserException.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 1999-2009 University of Chicago - * - * 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 org.nimbustools.messaging.rest; - -public class UnknownUserException extends Exception { - public UnknownUserException() { - } - - public UnknownUserException(String message) { - super(message); - } - - public UnknownUserException(String message, Throwable cause) { - super(message, cause); - } -} diff --git a/messaging/rest/java/source/src/org/nimbustools/messaging/rest/UsersResource.java b/messaging/rest/java/source/src/org/nimbustools/messaging/rest/UsersResource.java deleted file mode 100644 index 54950a80..00000000 --- a/messaging/rest/java/source/src/org/nimbustools/messaging/rest/UsersResource.java +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Copyright 1999-2009 University of Chicago - * - * 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 org.nimbustools.messaging.rest; - -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.*; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.UriInfo; -import javax.ws.rs.core.UriBuilder; -import java.util.List; -import java.lang.reflect.Method; - -import static org.nimbustools.messaging.rest.ResponseUtil.JSON_CONTENT_TYPE; -import org.nimbustools.messaging.rest.repr.User; -import org.nimbustools.messaging.rest.repr.AccessKey; -import org.springframework.beans.factory.InitializingBean; - -/** - * Query and modify the collection of Users - */ -public class UsersResource implements InitializingBean{ - - private UsersService usersService; - private ResponseUtil responseUtil; - - private final Method getUserMethod; - - public UsersResource() { - try { - getUserMethod = this.getClass().getMethod("getUser", String.class); - } catch (NoSuchMethodException e) { - throw new RuntimeException(e); - } - } - - @GET - @Path("/") - @Produces(JSON_CONTENT_TYPE) - public Response getUsers() { - - List users = this.usersService.getUsers(); - - return this.responseUtil.createJsonResponse(users); - } - - @GET - @Path("/{id}") - @Produces(JSON_CONTENT_TYPE) - public Response getUser(@PathParam("id") String id) { - - final User user = getUserById(id); - - return this.responseUtil.createJsonResponse(user); - } - - private User getUserById(String id) { - User user; - try { - - user = this.usersService.getUserById(id); - - } catch (UnknownUserException e) { - throw new NimbusWebException(Response.Status.NOT_FOUND, - "No such user",e); - } - return user; - } - - @POST - @Path("/") - @Consumes(JSON_CONTENT_TYPE) - public Response addUser(@Context UriInfo uriInfo, String userJson) { - - User user = responseUtil.fromJson(userJson, User.class); - - //TODO validate user - - try { - user = usersService.addUser(user); - } catch (DuplicateUserException e) { - throw new NimbusWebException(Response.Status.CONFLICT, - "A user with the provided DN already exists",e); - } - - final UriBuilder ub = uriInfo.getAbsolutePathBuilder().path(getUserMethod); - return responseUtil.createCreatedResponse(ub.build(user.getId()), user); - } - - @GET - @Path("/{userId}/access_key") - @Produces(JSON_CONTENT_TYPE) - public Response getAccessKey(@PathParam("userId") String userId) { - - final User user = getUserById(userId); - - try { - final AccessKey accessKey = usersService.getAccessKey(user); - - return responseUtil.createJsonResponse(accessKey); - - } catch (UnknownKeyException e) { - throw new NimbusWebException(Response.Status.NOT_FOUND, - "An access key does not exist for this user", e); - } - } - - @POST - @Path("/{userId}/access_key") - @Produces(JSON_CONTENT_TYPE) - public Response generateAccessKey(@PathParam("userId") String userId) { - - final User user = getUserById(userId); - final AccessKey accessKey = usersService.createAccessKey(user); - - return responseUtil.createJsonResponse(accessKey); - } - - public UsersService getUsersService() { - return usersService; - } - - public void setUsersService(UsersService usersService) { - this.usersService = usersService; - } - - public ResponseUtil getResponseUtil() { - return responseUtil; - } - - public void setResponseUtil(ResponseUtil responseUtil) { - this.responseUtil = responseUtil; - } - - public void afterPropertiesSet() throws Exception { - if (responseUtil == null) { - throw new IllegalArgumentException("responseUtil may not be null"); - } - } -} diff --git a/messaging/rest/java/source/src/org/nimbustools/messaging/rest/UsersService.java b/messaging/rest/java/source/src/org/nimbustools/messaging/rest/UsersService.java deleted file mode 100644 index bcb31736..00000000 --- a/messaging/rest/java/source/src/org/nimbustools/messaging/rest/UsersService.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 1999-2009 University of Chicago - * - * 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 org.nimbustools.messaging.rest; - -import org.nimbustools.messaging.rest.repr.User; -import org.nimbustools.messaging.rest.repr.AccessKey; - -import java.util.List; - -public interface UsersService { - - /** - * Retrieve a list of all users - * @return List of users - */ - List getUsers(); - - /** - * Retrieve a specific user by ID - * @param id ID of user to retrieve - * @return The user - * @throws UnknownUserException A user with specified ID does not exist - */ - User getUserById(String id) throws UnknownUserException; - - /** - * Add a new user - * @param user The user - * @return - * @throws DuplicateUserException User already exists - */ - User addUser(User user) throws DuplicateUserException; - - /** - * Retrieve the access key for a user - * @param user The user - * @return The access key - * @throws UnknownKeyException User does not have an access key - */ - AccessKey getAccessKey(User user) throws UnknownKeyException; - - /** - * Creates an access key for user. If a key exists, it will - * be discarded and replaced with a new one. - * @param user The user - * @return New access key - */ - AccessKey createAccessKey(User user); -} diff --git a/messaging/rest/java/source/src/org/nimbustools/messaging/rest/repr/AccessKey.java b/messaging/rest/java/source/src/org/nimbustools/messaging/rest/repr/AccessKey.java deleted file mode 100644 index e119ff48..00000000 --- a/messaging/rest/java/source/src/org/nimbustools/messaging/rest/repr/AccessKey.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 1999-2009 University of Chicago - * - * 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 org.nimbustools.messaging.rest.repr; - -import org.joda.time.DateTime; - -public class AccessKey { - private String key; - private String secret; - private boolean enabled; - private DateTime creationTime; - - public String getKey() { - return key; - } - - public void setKey(String key) { - this.key = key; - } - - public String getSecret() { - return secret; - } - - public void setSecret(String secret) { - this.secret = secret; - } - - public boolean isEnabled() { - return enabled; - } - - public void setEnabled(boolean enabled) { - this.enabled = enabled; - } - - public DateTime getCreationTime() { - return creationTime; - } - - public void setCreationTime(DateTime creationTime) { - this.creationTime = creationTime; - } -} diff --git a/messaging/rest/java/source/src/org/nimbustools/messaging/rest/repr/ErrorMessage.java b/messaging/rest/java/source/src/org/nimbustools/messaging/rest/repr/ErrorMessage.java deleted file mode 100644 index 085090a6..00000000 --- a/messaging/rest/java/source/src/org/nimbustools/messaging/rest/repr/ErrorMessage.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 1999-2009 University of Chicago - * - * 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 org.nimbustools.messaging.rest.repr; - -/** - * Simple error container shipped across the wire - */ -public class ErrorMessage { - - private final String message; - private final String requestId; - - public ErrorMessage(String msg, String requestId) { - this.message = msg; - this.requestId = requestId; - } - - public String getMessage() { - return message; - } - - public String getRequestId() { - return requestId; - } -} diff --git a/messaging/rest/java/source/src/org/nimbustools/messaging/rest/repr/User.java b/messaging/rest/java/source/src/org/nimbustools/messaging/rest/repr/User.java deleted file mode 100644 index 927200d8..00000000 --- a/messaging/rest/java/source/src/org/nimbustools/messaging/rest/repr/User.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 1999-2009 University of Chicago - * - * 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 org.nimbustools.messaging.rest.repr; - -public class User { - - private String id; - private String dn; - private String name; - private String group; - - - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getDn() { - return dn; - } - - public void setDn(String dn) { - this.dn = dn; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getGroup() { - return group; - } - - public void setGroup(String group) { - this.group = group; - } -} diff --git a/scripts/lib/gt4.0/build/build.xml b/scripts/lib/gt4.0/build/build.xml index d14b9a55..2037b4df 100644 --- a/scripts/lib/gt4.0/build/build.xml +++ b/scripts/lib/gt4.0/build/build.xml @@ -64,7 +64,6 @@ - @@ -295,14 +294,8 @@ - - - - - - diff --git a/service/service/java/tests/suites/basic/home/services/etc/nimbus/elastic/other/main.conflocator.xml b/service/service/java/tests/suites/basic/home/services/etc/nimbus/elastic/other/main.conflocator.xml index fecea13b..77e74f98 100644 --- a/service/service/java/tests/suites/basic/home/services/etc/nimbus/elastic/other/main.conflocator.xml +++ b/service/service/java/tests/suites/basic/home/services/etc/nimbus/elastic/other/main.conflocator.xml @@ -48,10 +48,4 @@ - - - - - - \ No newline at end of file + diff --git a/service/service/java/tests/suites/basic/home/services/etc/nimbus/elastic/other/main.xml b/service/service/java/tests/suites/basic/home/services/etc/nimbus/elastic/other/main.xml index 29b2eb0b..fc7cfdea 100644 --- a/service/service/java/tests/suites/basic/home/services/etc/nimbus/elastic/other/main.xml +++ b/service/service/java/tests/suites/basic/home/services/etc/nimbus/elastic/other/main.xml @@ -208,18 +208,6 @@ - - - - - - - - - - diff --git a/service/service/java/tests/suites/basic/home/services/etc/nimbus/rest/other/main-fake.xml b/service/service/java/tests/suites/basic/home/services/etc/nimbus/rest/other/main-fake.xml deleted file mode 100644 index e0d3a9fb..00000000 --- a/service/service/java/tests/suites/basic/home/services/etc/nimbus/rest/other/main-fake.xml +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/service/service/java/tests/suites/basic/home/services/etc/nimbus/rest/other/main.conflocator.xml b/service/service/java/tests/suites/basic/home/services/etc/nimbus/rest/other/main.conflocator.xml deleted file mode 100644 index 8a0ea8a3..00000000 --- a/service/service/java/tests/suites/basic/home/services/etc/nimbus/rest/other/main.conflocator.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - diff --git a/service/service/java/tests/suites/basic/home/services/etc/nimbus/rest/other/main.xml b/service/service/java/tests/suites/basic/home/services/etc/nimbus/rest/other/main.xml deleted file mode 100644 index ed827bf7..00000000 --- a/service/service/java/tests/suites/basic/home/services/etc/nimbus/rest/other/main.xml +++ /dev/null @@ -1,86 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/service/service/java/tests/suites/basic/home/services/etc/nimbus/rest/rest.conf b/service/service/java/tests/suites/basic/home/services/etc/nimbus/rest/rest.conf deleted file mode 100644 index 051038f4..00000000 --- a/service/service/java/tests/suites/basic/home/services/etc/nimbus/rest/rest.conf +++ /dev/null @@ -1,12 +0,0 @@ -rest.enabled=false -rest.port=4443 - -keystore.path=$NIMBUS_HOME/var/keystore.jks -keystore.password=secrets - -gridmap.path=file:///path/to/grid-mapfile -groupauthz.path= -query.usermap.path=$NIMBUS_HOME/services/etc/nimbus/query/users.txt -gridmap.localuser=cloudimages - -rest.spring.path=$NIMBUS_HOME/services/etc/nimbus/rest/other/main.xml