001/* 002 * (C) Copyright 2006-2010 Nuxeo SAS (http://nuxeo.com/) and contributors. 003 * 004 * All rights reserved. This program and the accompanying materials 005 * are made available under the terms of the GNU Lesser General Public License 006 * (LGPL) version 2.1 which accompanies this distribution, and is available at 007 * http://www.gnu.org/licenses/lgpl.html 008 * 009 * This library is distributed in the hope that it will be useful, 010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 012 * Lesser General Public License for more details. 013 * 014 * Contributors: 015 * bstefanescu 016 */ 017package org.nuxeo.runtime.reload; 018 019import java.io.File; 020import java.io.IOException; 021 022import org.nuxeo.runtime.deployment.preprocessor.DeploymentPreprocessor; 023import org.nuxeo.runtime.service.TimestampedService; 024import org.osgi.framework.BundleException; 025 026/** 027 * Service tracking reload related events or commands when installing a package 028 * 029 * @author <a href="mailto:bs@nuxeo.com">Bogdan Stefanescu</a> 030 */ 031public interface ReloadService extends TimestampedService { 032 033 public static final String RELOAD_TOPIC = "org.nuxeo.runtime.reload"; 034 035 public static final String FLUSH_EVENT_ID = "flush"; 036 037 public static final String RELOAD_EVENT_ID = "reload"; 038 039 public static final String FLUSH_SEAM_EVENT_ID = FLUSH_EVENT_ID+"SeamComponents"; 040 041 public static final String RELOAD_SEAM_EVENT_ID = "reloadSeamComponents"; 042 043 public static final String RELOAD_REPOSITORIES_ID = "reloadRepositories"; 044 045 /** 046 * Sends a runtime event with id {@link #RELOAD_EVENT_ID} so that listeners can be notified that a reload has been 047 * done. 048 * <p> 049 * Also calls {@link #reloadProperties()} by default, but not other reload methods as they could alter the running 050 * application behaviour. 051 * 052 * @since 5.5 053 * @see #reloadProperties() 054 */ 055 void reload(); 056 057 /** 058 * Reloads the Nuxeo repository configuration 059 */ 060 void reloadRepository(); 061 062 /** 063 * Reloads runtime framework properties 064 */ 065 void reloadProperties() throws IOException; 066 067 /** 068 * Sends a runtime event with id {@link #RELOAD_SEAM_EVENT_ID} 069 * 070 * @since 5.5 071 */ 072 void reloadSeamComponents(); 073 074 /** 075 * Sends a runtime event with id {@link #FLUSH_EVENT_ID} so that listeners can be notified that a flush is needed 076 * (after a reload for instance). 077 * <p> 078 * Also calls {@link #flushJaasCache()} by default, but not other flush methods as they could alter the running 079 * application behaviour. 080 * 081 * @see {@link #flushJaasCache()} 082 * @since 5.5 083 */ 084 void flush(); 085 086 /** 087 * Returns the last time one of the flush commands where called on this service instance ({@link #flush()} or 088 * {@link #flushJaasCache()} or {@link #flushSeamComponents()}, or null if never called 089 * 090 * @since 5.6 091 */ 092 Long lastFlushed(); 093 094 /** 095 * Sends an event that can trigger reset of JaasCache 096 */ 097 void flushJaasCache(); 098 099 /** 100 * Sends a runtime event with id {@link #FLUSH_SEAM_EVENT_ID} 101 * 102 * @since 5.6 103 */ 104 void flushSeamComponents(); 105 106 /** 107 * Deploys bundle to the runtime, without reloading resources 108 * 109 * @since 5.5 110 * @see #deployBundle(File, boolean) 111 */ 112 String deployBundle(File file) throws BundleException; 113 114 /** 115 * Deploys bundle to the runtime, gives possibility to control resources reloading. 116 * 117 * @since 5.5 118 */ 119 String deployBundle(File file, boolean reloadResources) throws BundleException; 120 121 /** 122 * Undeploys bundle from the runtime, given the bundle resource, gives possibility to control resources reloading 123 * 124 * @since 5.6 125 */ 126 void undeployBundle(File file, boolean reloadResources) throws BundleException; 127 128 /** 129 * Undeploys bundle from the runtime, given the bundle filename 130 * 131 * @since 5.6 132 */ 133 void undeployBundle(String bundleName) throws BundleException; 134 135 /** 136 * Runs the deployment preprocessor 137 * 138 * @since 5.6 139 * @See {@link DeploymentPreprocessor} 140 */ 141 public void runDeploymentPreprocessor() throws IOException; 142 143 /** 144 * Copies the bundle web resources into the nuxeo WAR directory. 145 * 146 * @since 5.5 147 * @deprecated since 5.6: {@link #runDeploymentPreprocessor()} method now re-deploys all jars so that the nuxeo.war 148 * holds the same content than it would at startup. 149 */ 150 @Deprecated 151 void installWebResources(File file) throws IOException; 152 153 /*** 154 * Returns the OSGI bundle name if given file can be identified as an OSGI bundle, or null. The OSGI bundle can be a 155 * jar or an exploded jar on file system. 156 * 157 * @since 5.6 158 */ 159 String getOSGIBundleName(File file); 160 161}