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