uidesigner/com.nokia.sdt.uimodel/src/com/nokia/sdt/component/IComponent.java
changeset 0 fb279309251b
equal deleted inserted replaced
-1:000000000000 0:fb279309251b
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 /**
       
    18  * 
       
    19  */
       
    20 package com.nokia.sdt.component;
       
    21 
       
    22 import com.nokia.cpp.internal.api.utils.core.MessageLocation;
       
    23 
       
    24 import org.eclipse.core.runtime.IAdaptable;
       
    25 import org.osgi.framework.Bundle;
       
    26 import org.osgi.framework.Version;
       
    27 
       
    28 import java.io.*;
       
    29 
       
    30 /** 
       
    31  * The main interface for a component.
       
    32  * Each aspect of component information and behavior
       
    33  * is implemented by one or more adapters. Adapters
       
    34  * are obtained from each component's provider. 
       
    35  * <p>
       
    36  * This approach allows the provider to specify how adapters
       
    37  * are implemented for the components in provides.
       
    38  * <p>
       
    39  * The set of adapters can be extended by getting
       
    40  * component provider from the component system
       
    41  * and registering new adapter factories.
       
    42  * <p>
       
    43  * Here's an example of obtaining an adapter:
       
    44  * <pre>
       
    45  * IComponent myComponent = ...
       
    46  * IPropertyDescriptorProvider pdProvider =
       
    47  *     myComponent.getAdapter(IPropertyDescriptorProvider.class);
       
    48  * </pre>
       
    49  */
       
    50 public interface IComponent extends IAdaptable {
       
    51 	
       
    52 	/**
       
    53 	 * Returns the provider that implements this component type
       
    54 	 */
       
    55 	IComponentProvider getProvider();
       
    56 	
       
    57 	/**
       
    58 	 * Returns the bundle providing this component (may be null)
       
    59 	 */
       
    60 	Bundle getBundle();
       
    61 	
       
    62     /** 
       
    63      * Returns the component's unique id. The convention
       
    64      * for component naming is specific to a provider, but
       
    65      * each id must be unique to the provider.
       
    66      */
       
    67     String getId();
       
    68 	
       
    69 	/**
       
    70 	 * Returns the component's category, if any.
       
    71 	 * The result should be already localized, if possible.
       
    72 	 */
       
    73 	String getCategory();
       
    74 	
       
    75 	/**
       
    76 	 * Returns the component's version as an OSGI version object.
       
    77 	 * @return
       
    78 	 */
       
    79 	public Version getComponentVersion();
       
    80 	
       
    81 	/**
       
    82 	 * Returns a string used as the root part of a
       
    83 	 * component instance name. This root can have a prefix
       
    84 	 * and suffix added for uniqueness and source generation purposes.
       
    85 	 * This method should just return a base name that makes sense
       
    86 	 * for the component without regard to uniqueness or source
       
    87 	 * generation issues.
       
    88 	 */
       
    89 	String getInstanceNameRoot();
       
    90     
       
    91 	/**
       
    92 	 * Returns the "friendly name" attribute of the component.
       
    93 	 * @return friendly name String
       
    94 	 */
       
    95 	String getFriendlyName();
       
    96 	
       
    97 	/**
       
    98 	 * Returns the base component's unique id, or null if no base component
       
    99 	 */
       
   100 	String getBaseComponentId();
       
   101 	
       
   102 	/**
       
   103      * Returns the immediate base component for this component.
       
   104      */
       
   105     IComponent getComponentBase();
       
   106     
       
   107     /**
       
   108      * An abstract component can act as a base component but cannot be instantiated
       
   109      */
       
   110     boolean isAbstract();
       
   111     
       
   112     /**
       
   113      * Returns the component set this component belongs to.
       
   114      * Each component is shallow-copied into a component set.
       
   115      * @returns IComponentSet or null if this component comes straight
       
   116      * from a component provider.   
       
   117      */
       
   118     IComponentSet getComponentSet();
       
   119     
       
   120     /**
       
   121      * Create a message location based on this component,
       
   122      * e.g. for reporting errors that come from a component definition.
       
   123      */
       
   124     MessageLocation createMessageLocation();
       
   125 
       
   126     /**
       
   127      * Get the base directory of the component.
       
   128      * May return null if component is not located on disk.
       
   129      */
       
   130     File getBaseDirectory();
       
   131 }