/* * Copyright the original author or authors. * * Licensed under the MOZILLA PUBLIC LICENSE, Version 1.1 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.mozilla.org/MPL/MPL-1.1.html * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.bourre.plugin { import com.bourre.events.EventChannel; import com.bourre.model.AbstractModel; import com.bourre.view.AbstractView; import flash.events.Event; /** * The Plugin interface defines rules for IoC plugin implementation. * * @author Francis Bourre */ public interface Plugin { /** * Fires events using dedicated event channel. * *

Only listeners on this event channel can receive * the event.

*/ function fireExternalEvent( e : Event, channel : EventChannel ) : void; /** * Fires events using public event channel. * *

Each plugin who listen this type of event will be * triggered.

*/ function firePublicEvent( e : Event ) : void; /** * Fires events using private ( internal ) event channel. * *

These events can be only handled by this plugin itself.
* Others plugins in context can't listen this event.

*/ function firePrivateEvent( e : Event ) : void; /** * Returns plugin's event channel. */ function getChannel() : EventChannel; /** * Returns plugin's debug channel. */ function getLogger() : PluginDebug; /** * Returns an AbstractModel instance if it is * registered in model locator with passed-in key * identifier. * * @param key Model identifier to return. * * @return The model registered with passed-in key or null */ function getModel( key : String ) : AbstractModel; /** * Returns an AbstractView instance if it is * registered in view locator with passed-in key * identifier. * * @param key View identifier to return. * * @return The view registered with passed-in key or null */ function getView( key : String ) : AbstractView; /** * Returns true if a model is registered in model * locator with passed-in name. * * @param name Model identifier to search * * @return true if a model is registered in model * locator with passed-in name. */ function isModelRegistered( name : String ) : Boolean; /** * Returns true if a view is registered in view * locator with passed-in name. * * @param name View identifier to search * * @return true if a view is registered in model * locator with passed-in name. */ function isViewRegistered( name : String ) : Boolean; /** * Triggered when all IoC processing is finished. */ function onApplicationInit( ) : void; } }