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