1 /* 2 * The contents of this file are subject to the terms 3 * of the Common Development and Distribution License 4 * (the "License"). You may not use this file except 5 * in compliance with the License. 6 * 7 * You can obtain a copy of the license at 8 * https://open-esb.dev.java.net/public/CDDLv1.0.html. 9 * See the License for the specific language governing 10 * permissions and limitations under the License. 11 * 12 * When distributing Covered Code, include this CDDL 13 * HEADER in each file and include the License file at 14 * https://open-esb.dev.java.net/public/CDDLv1.0.html. 15 * If applicable add the following below this CDDL HEADER, 16 * with the fields enclosed by brackets "[]" replaced with 17 * your own identifying information: Portions Copyright 18 * [year] [name of copyright owner] 19 */ 20 21 /* 22 * Copyright 2004-2006 Sun Microsystems, Inc. All Rights Reserved. 23 */ 24 25 /* 26 * ComponentInstaller.java 27 * 28 */ 29 30 package it.imolinfo.jbi4ejb.jbi.component.runtime; 31 32 import it.imolinfo.jbi4ejb.Logger; 33 import it.imolinfo.jbi4ejb.LoggerFactory; 34 import it.imolinfo.jbi4ejb.jbi.Messages; 35 import javax.jbi.component.Bootstrap; 36 import javax.jbi.component.InstallationContext; 37 import javax.jbi.JBIException; 38 39 /** 40 * This is a default implemenation of the Bootstrap interface. 41 * The component implemenation can extend this class and implement 42 * component specific installation such as configuration and creation of 43 * of the resources. 44 * 45 * @see javax.jbi.Bootstrap 46 * 47 * @author Sun Microsystems, Inc. 48 */ 49 public class ComponentInstaller implements Bootstrap { 50 51 /** The logger. */ 52 private static final Logger LOG = LoggerFactory.getLogger(ComponentInstaller.class); 53 private static final Messages MESSAGES = Messages.getMessages(ComponentInstaller.class); 54 55 /** 56 * Installation Context . 57 */ 58 private InstallationContext mContext; 59 60 /** 61 * Constructor to creatre the ComponentInstaller. 62 */ 63 public ComponentInstaller() { 64 } 65 66 /** 67 * default noop implementation of the cleanup. 68 * @see javax.jbi.component.Bootstrap#cleanUp() 69 */ 70 public void cleanUp() 71 throws javax.jbi.JBIException { 72 LOG.info("EJB000210_Component_Installer_Cleaned_up"); 73 } 74 75 /** 76 * Initializes the installation environment for a component. 77 * 78 * @see javax.jbi.component.Bootstrap#init(javax.jbi.component.InstallationContext) 79 */ 80 public void init(InstallationContext installContext) 81 throws javax.jbi.JBIException { 82 83 if ( installContext == null ) { 84 String msg=MESSAGES.getString("EJB000211_Null_Installation_Context_received"); 85 LOG.error(msg); 86 throw new JBIException(msg); 87 88 } 89 90 91 // initialize reference to component context 92 this.mContext = installContext; 93 94 LOG.info("EJB000212_Component_Installer_initialized"); 95 } 96 97 /** 98 * default implemenation that does not have extension mbean return null. 99 * 100 * @see javax.jbi.component.Bootstrap#getExtensionMBeanName() 101 */ 102 public javax.management.ObjectName getExtensionMBeanName() { 103 return null; 104 } 105 106 /** 107 * default implemenation just logs the method call. 108 * @see javax.jbi.component.Bootstrap#onInstall() 109 */ 110 public void onInstall() 111 throws javax.jbi.JBIException { 112 LOG.info("EJB000213_Component_Installed"); 113 } 114 115 /** 116 * default implemenation just logs the method call. 117 * 118 * @see javax.jbi.component.Bootstrap#onUninstall() 119 */ 120 public void onUninstall() 121 throws javax.jbi.JBIException { 122 LOG.info("EJB000214_Component_Uninstalled"); 123 } 124 125 }