001/* 002 * Copyright (c) 2006-2011 Nuxeo SA (http://nuxeo.com/) and others. 003 * 004 * All rights reserved. This program and the accompanying materials 005 * are made available under the terms of the Eclipse Public License v1.0 006 * which accompanies this distribution, and is available at 007 * http://www.eclipse.org/legal/epl-v10.html 008 * 009 * Contributors: 010 * Nuxeo - initial API and implementation 011 * 012 * $Id$ 013 */ 014 015package org.nuxeo.runtime.model; 016 017import java.io.Serializable; 018import java.net.URL; 019import java.util.Map; 020import java.util.Set; 021 022import org.nuxeo.runtime.Version; 023 024/** 025 * The component registration info. 026 * <p> 027 * A registration info object is keeping all the information needed to deploy a component, like the component 028 * implementation, properties, dependencies and also the defined extension points and contributed extensions. 029 * <p> 030 * When a component is activated the registration info is creating a component instance using the current runtime 031 * context. 032 * 033 * @author <a href="mailto:bs@nuxeo.com">Bogdan Stefanescu</a> 034 */ 035public interface RegistrationInfo extends Serializable { 036 037 int UNREGISTERED = 0; 038 039 int REGISTERED = 1; 040 041 /** 042 * Component dependencies are resolved 043 */ 044 int RESOLVED = 2; 045 046 /** 047 * Component activation successful 048 */ 049 int ACTIVATED = 3; 050 051 /** 052 * Before component activation 053 */ 054 int ACTIVATING = 4; 055 056 int DEACTIVATING = 5; 057 058 /** 059 * Notification of applicationStarted fails 060 * 061 * @since 7.4 062 */ 063 int START_FAILURE = 6; 064 065 /** 066 * Gets the component version. 067 */ 068 Version getVersion(); 069 070 /** 071 * Get the owner bundle symbolic name of that component. If null the default owner is used. 072 * 073 * @return 074 */ 075 String getBundle(); 076 077 /** 078 * Gets any comments on this component. 079 */ 080 String getDocumentation(); 081 082 /** 083 * Gets the runtime context that created this registration info. 084 * 085 * @return the runtime context 086 */ 087 RuntimeContext getContext(); 088 089 /** 090 * Gets the component properties. 091 * 092 * @return the component properties 093 */ 094 Map<String, Property> getProperties(); 095 096 /** 097 * Gets the list of aliases. 098 * 099 * @return the aliases 100 */ 101 Set<ComponentName> getAliases(); 102 103 /** 104 * Gets the list of the required components. 105 * 106 * @return the required components 107 */ 108 Set<ComponentName> getRequiredComponents(); 109 110 /** 111 * Gets the defined extension points. 112 * 113 * @return the defined extension points 114 */ 115 ExtensionPoint[] getExtensionPoints(); 116 117 /** 118 * Gets the extensions contributed by this component. 119 * 120 * @return the contributed extensions 121 */ 122 Extension[] getExtensions(); 123 124 /** 125 * Gets the name of the component. 126 * 127 * @return the component name 128 */ 129 ComponentName getName(); 130 131 /** 132 * Whether this component is disabled. For now this is used only for persistent components. 133 * 134 * @return 135 */ 136 boolean isDisabled(); 137 138 /** 139 * Gets the component instance or null if the component was not yet activated. 140 * 141 * @return the component instance 142 */ 143 ComponentInstance getComponent(); 144 145 /** 146 * Gets the component state. 147 * 148 * @return the component state 149 */ 150 int getState(); 151 152 /** 153 * Gets the component manager. 154 * 155 * @return the component manager 156 */ 157 ComponentManager getManager(); 158 159 /** 160 * Checks whether this component is activated. 161 * 162 * @return true if the component is activated, false otherwise 163 */ 164 boolean isActivated(); 165 166 /** 167 * Checks whether this component is resolved (i˙e˙ all its dependencies are satisfied). 168 * 169 * @return true if the component is resolved, false otherwise 170 */ 171 boolean isResolved(); 172 173 /** 174 * Gets the list of provided services or null if no service is provided. 175 * 176 * @return an array containing the service class names or null if no service are provided 177 */ 178 String[] getProvidedServiceNames(); 179 180 /** 181 * Whether or not this registration is persisted by the user (not part of a real bundle). 182 * 183 * @return true if persisted, false otherwise 184 */ 185 boolean isPersistent(); 186 187 /** 188 * Set the persistent flag on this registration 189 * 190 * @param isPersistent 191 */ 192 void setPersistent(boolean isPersistent); 193 194 /** 195 * Give the class name for the component implementation if this is a java component 196 * 197 * @return class name 198 */ 199 String getImplementation(); 200 201 /** 202 * Retrieve the URL of the XML file used to declare the component 203 * 204 * @return the XML file URL 205 */ 206 URL getXmlFileUrl(); 207 208 /** 209 * The component notification order for {@link #notifyApplicationStarted}. 210 * 211 * @return the order, 1000 by default 212 * @since 5.6 213 */ 214 int getApplicationStartedOrder(); 215 216 /** 217 * Notify the component instance that the Nuxeo application started 218 */ 219 void notifyApplicationStarted(); 220}