| /* |
| * Copyright (c) 2003, 2018 Oracle and/or its affiliates. All rights reserved. |
| * |
| * This program and the accompanying materials are made available under the |
| * terms of the Eclipse Public License v. 2.0, which is available at |
| * http://www.eclipse.org/legal/epl-2.0. |
| * |
| * This Source Code may also be made available under the following Secondary |
| * Licenses when the conditions for such availability set forth in the |
| * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, |
| * version 2 with the GNU Classpath Exception, which is available at |
| * https://www.gnu.org/software/classpath/license.html. |
| * |
| * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 |
| */ |
| |
| package com.sun.cb; |
| |
| import java.util.ResourceBundle; |
| import javax.xml.registry.*; |
| import javax.xml.registry.infomodel.Key; |
| import java.io.*; |
| |
| public class OrgRemover { |
| |
| Connection connection = null; |
| |
| public static void main(String[] args) { |
| |
| String keyStr = null; |
| |
| String queryURL = URLHelper.getQueryURL(); |
| String publishURL = URLHelper.getPublishURL(); |
| |
| ResourceBundle registryBundle = |
| ResourceBundle.getBundle("com.sun.cb.CoffeeRegistry"); |
| |
| String username = |
| registryBundle.getString("registry.username"); |
| String password = |
| registryBundle.getString("registry.password"); |
| String keyFile = registryBundle.getString("key.file"); |
| |
| try { |
| FileReader in = new FileReader(keyFile); |
| char[] buf = new char[512]; |
| while (in.read(buf, 0, 512) >= 0) { } |
| in.close(); |
| keyStr = new String(buf).trim(); |
| } catch (IOException ex) { |
| System.out.println(ex.getMessage()); |
| } |
| |
| JAXRRemover remover = new JAXRRemover(); |
| remover.makeConnection(queryURL, publishURL); |
| javax.xml.registry.infomodel.Key modelKey = null; |
| modelKey = remover.createOrgKey(keyStr); |
| remover.executeRemove(modelKey, username, password); |
| } |
| } |