| <?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../jacoco-resources/report.css" type="text/css"/><link rel="shortcut icon" href="../jacoco-resources/report.gif" type="image/gif"/><title>RMIRegistration.java</title><link rel="stylesheet" href="../jacoco-resources/prettify.css" type="text/css"/><script type="text/javascript" src="../jacoco-resources/prettify.js"></script></head><body onload="window['PR_TAB_WIDTH']=4;prettyPrint()"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../jacoco-sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">jUDDI Core Services</a> > <a href="index.source.html" class="el_package">org.apache.juddi.rmi</a> > <span class="el_source">RMIRegistration.java</span></div><h1>RMIRegistration.java</h1><pre class="source lang-java linenums">/* |
| * Copyright 2001-2009 The Apache Software Foundation. |
| * |
| * 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.apache.juddi.rmi; |
| |
| import java.rmi.RemoteException; |
| import java.rmi.registry.LocateRegistry; |
| import java.rmi.registry.Registry; |
| |
| import javax.naming.NamingException; |
| |
| import org.apache.commons.logging.Log; |
| import org.apache.commons.logging.LogFactory; |
| |
| /** |
| * @author Kurt Stam (kstam@apache.org) |
| */ |
| public class RMIRegistration |
| { |
| public static final String JUDDI = "/juddiv3"; |
| public static final String UDDI_SECURITY_SERVICE = JUDDI + "/UDDISecurityService"; |
| public static final String UDDI_PUBLICATION_SERVICE = JUDDI + "/UDDIPublicationService"; |
| public static final String UDDI_INQUIRY_SERVICE = JUDDI + "/UDDIInquiryService"; |
| public static final String UDDI_SUBSCRIPTION_SERVICE = JUDDI + "/UDDISubscriptionService"; |
| public static final String UDDI_SUBSCRIPTION_LISTENER_SERVICE = JUDDI + "/UDDISubscriptionListenerService"; |
| public static final String UDDI_CUSTODY_TRANSFER_SERVICE = JUDDI + "/UDDICustodyTransferService"; |
| public static final String JUDDI_PUBLISHER_SERVICE = JUDDI + "/JUDDIApiService"; |
| |
| <span class="nc" id="L41"> private UDDISecurityService securityService = null;</span> |
| <span class="nc" id="L42"> private UDDIPublicationService publicationService = null;</span> |
| <span class="nc" id="L43"> private UDDIInquiryService inquiryService = null;</span> |
| <span class="nc" id="L44"> private UDDISubscriptionService subscriptionService = null;</span> |
| <span class="nc" id="L45"> private UDDISubscriptionListenerService subscriptionListenerService = null;</span> |
| <span class="nc" id="L46"> private UDDICustodyTransferService custodyTransferService = null;</span> |
| <span class="nc" id="L47"> private JUDDIApiService publisherService = null;</span> |
| |
| <span class="nc" id="L49"> private Log log = LogFactory.getLog(this.getClass());</span> |
| <span class="nc" id="L50"> Registry registry = null;</span> |
| <span class="nc" id="L51"> private static RMIRegistration registration = null;</span> |
| |
| public static RMIRegistration getInstance(int port) throws NamingException, RemoteException { |
| <span class="nc bnc" id="L54" title="All 2 branches missed."> if (registration==null) {</span> |
| <span class="nc" id="L55"> registration = new RMIRegistration(port);</span> |
| } |
| <span class="nc" id="L57"> return registration;</span> |
| } |
| |
| private RMIRegistration(int port) throws NamingException, RemoteException{ |
| <span class="nc" id="L61"> super();</span> |
| <span class="nc" id="L62"> registry = LocateRegistry.createRegistry(port);</span> |
| <span class="nc" id="L63"> }</span> |
| /** |
| * Registers the Publish and Inquiry Services to JNDI and instantiates a |
| * instance of each so we can remotely attach to it later. |
| */ |
| public void register(int port) { |
| try { |
| <span class="nc" id="L70"> securityService = new UDDISecurityService(port);</span> |
| <span class="nc bnc" id="L71" title="All 2 branches missed."> if (log.isDebugEnabled()) log.debug("Setting " + UDDI_SECURITY_SERVICE + ", " + securityService.getClass());</span> |
| <span class="nc" id="L72"> registry.bind(UDDI_SECURITY_SERVICE, securityService);</span> |
| |
| <span class="nc" id="L74"> publicationService = new UDDIPublicationService(port);</span> |
| <span class="nc bnc" id="L75" title="All 2 branches missed."> if (log.isDebugEnabled()) log.debug("Setting " + UDDI_PUBLICATION_SERVICE + ", " + publicationService.getClass());</span> |
| <span class="nc" id="L76"> registry.bind(UDDI_PUBLICATION_SERVICE, publicationService);</span> |
| |
| <span class="nc" id="L78"> inquiryService = new UDDIInquiryService(port);</span> |
| <span class="nc bnc" id="L79" title="All 2 branches missed."> if (log.isDebugEnabled()) log.debug("Setting " + UDDI_INQUIRY_SERVICE + ", " + inquiryService.getClass());</span> |
| <span class="nc" id="L80"> registry.bind(UDDI_INQUIRY_SERVICE, inquiryService);</span> |
| |
| <span class="nc" id="L82"> subscriptionService = new UDDISubscriptionService(port);</span> |
| <span class="nc bnc" id="L83" title="All 2 branches missed."> if (log.isDebugEnabled()) log.debug("Setting " + UDDI_SUBSCRIPTION_SERVICE + ", " + subscriptionService.getClass());</span> |
| <span class="nc" id="L84"> registry.bind(UDDI_SUBSCRIPTION_SERVICE, subscriptionService);</span> |
| |
| <span class="nc" id="L86"> subscriptionListenerService = new UDDISubscriptionListenerService(port);</span> |
| <span class="nc bnc" id="L87" title="All 2 branches missed."> if (log.isDebugEnabled()) log.debug("Setting " + UDDI_SUBSCRIPTION_LISTENER_SERVICE + ", " + subscriptionListenerService.getClass());</span> |
| <span class="nc" id="L88"> registry.bind(UDDI_SUBSCRIPTION_LISTENER_SERVICE, subscriptionListenerService);</span> |
| |
| <span class="nc" id="L90"> custodyTransferService = new UDDICustodyTransferService(port);</span> |
| <span class="nc bnc" id="L91" title="All 2 branches missed."> if (log.isDebugEnabled()) log.debug("Setting " + UDDI_CUSTODY_TRANSFER_SERVICE + ", " + custodyTransferService.getClass());</span> |
| <span class="nc" id="L92"> registry.bind(UDDI_CUSTODY_TRANSFER_SERVICE, custodyTransferService);</span> |
| |
| <span class="nc" id="L94"> publisherService = new JUDDIApiService(port);</span> |
| <span class="nc bnc" id="L95" title="All 2 branches missed."> if (log.isDebugEnabled()) log.debug("Setting " + JUDDI_PUBLISHER_SERVICE + ", " + publisherService.getClass());</span> |
| <span class="nc" id="L96"> registry.bind(JUDDI_PUBLISHER_SERVICE, publisherService);</span> |
| |
| <span class="nc" id="L98"> } catch (Exception e) {</span> |
| <span class="nc" id="L99"> log.error(e.getMessage(),e);</span> |
| <span class="nc" id="L100"> }</span> |
| <span class="nc" id="L101"> }</span> |
| |
| public void unregister() { |
| |
| try { |
| <span class="nc" id="L106"> registry.unbind(UDDI_SECURITY_SERVICE);</span> |
| <span class="nc" id="L107"> } catch (Exception e) {</span> |
| <span class="nc" id="L108"> log.error(e.getMessage(),e);</span> |
| <span class="nc" id="L109"> }</span> |
| <span class="nc" id="L110"> securityService = null;</span> |
| try { |
| <span class="nc" id="L112"> registry.unbind(UDDI_PUBLICATION_SERVICE);</span> |
| <span class="nc" id="L113"> } catch (Exception e) {</span> |
| <span class="nc" id="L114"> log.error(e.getMessage(),e);</span> |
| <span class="nc" id="L115"> }</span> |
| <span class="nc" id="L116"> publicationService = null;</span> |
| try { |
| <span class="nc" id="L118"> registry.unbind(UDDI_INQUIRY_SERVICE);</span> |
| <span class="nc" id="L119"> } catch (Exception e) {</span> |
| <span class="nc" id="L120"> log.error(e.getMessage(),e);</span> |
| <span class="nc" id="L121"> }</span> |
| <span class="nc" id="L122"> inquiryService = null;</span> |
| try { |
| <span class="nc" id="L124"> registry.unbind(UDDI_SUBSCRIPTION_SERVICE);</span> |
| <span class="nc" id="L125"> } catch (Exception e) {</span> |
| <span class="nc" id="L126"> log.error(e.getMessage(),e);</span> |
| <span class="nc" id="L127"> }</span> |
| <span class="nc" id="L128"> subscriptionService = null;</span> |
| try { |
| <span class="nc" id="L130"> registry.unbind(UDDI_SUBSCRIPTION_LISTENER_SERVICE);</span> |
| <span class="nc" id="L131"> } catch (Exception e) {</span> |
| <span class="nc" id="L132"> log.error(e.getMessage(),e);</span> |
| <span class="nc" id="L133"> }</span> |
| <span class="nc" id="L134"> subscriptionListenerService = null;</span> |
| try { |
| <span class="nc" id="L136"> registry.unbind(UDDI_CUSTODY_TRANSFER_SERVICE);</span> |
| <span class="nc" id="L137"> } catch (Exception e) {</span> |
| <span class="nc" id="L138"> log.error(e.getMessage(),e);</span> |
| <span class="nc" id="L139"> }</span> |
| <span class="nc" id="L140"> custodyTransferService = null;</span> |
| try { |
| <span class="nc" id="L142"> registry.unbind(JUDDI_PUBLISHER_SERVICE);</span> |
| <span class="nc" id="L143"> } catch (Exception e) {</span> |
| <span class="nc" id="L144"> log.error(e.getMessage(),e);</span> |
| <span class="nc" id="L145"> }</span> |
| <span class="nc" id="L146"> publisherService = null;</span> |
| |
| <span class="nc" id="L148"> }</span> |
| } |
| </pre><div class="footer"><span class="right">Created with <a href="http://www.jacoco.org/jacoco">JaCoCo</a> 0.7.9.201702052155</span></div></body></html> |