List of usage examples for javax.xml.registry BusinessLifeCycleManager deleteClassificationSchemes
BulkResponse deleteClassificationSchemes(Collection schemeKeys) throws JAXRException;
From source file:JAXRDeleteScheme.java
/** * Removes the classification scheme with the specified key value. *// ww w. j a v a 2 s .com * @param key the Key of the organization * @param username the username for the registry * @param password the password for the registry */ public void executeRemove(Key key, String username, String password) { BusinessLifeCycleManager blcm = null; try { blcm = rs.getBusinessLifeCycleManager(); // Get authorization from the registry PasswordAuthentication passwdAuth = new PasswordAuthentication(username, password.toCharArray()); HashSet<PasswordAuthentication> creds = new HashSet<PasswordAuthentication>(); creds.add(passwdAuth); connection.setCredentials(creds); System.out.println("Established security credentials"); String id = key.getId(); System.out.println("Deleting classification scheme with id " + id); Collection<Key> keys = new ArrayList<Key>(); keys.add(key); BulkResponse response = blcm.deleteClassificationSchemes(keys); Collection exceptions = response.getExceptions(); if (exceptions == null) { System.out.println("Classification scheme deleted"); Collection retKeys = response.getCollection(); for (Object k : retKeys) { Key schemeKey = (Key) k; id = schemeKey.getId(); System.out.println("Classification scheme key was " + id); } } else { for (Object e : exceptions) { Exception exception = (Exception) e; System.err.println("Exception on delete: " + exception.toString()); } } } catch (Exception e) { e.printStackTrace(); } finally { // At end, close connection to registry if (connection != null) { try { connection.close(); } catch (JAXRException je) { } } } }