001 /* 002 * Copyright (c) 2005 Stephen J. McConnell 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 013 * implied. 014 * 015 * See the License for the specific language governing permissions and 016 * limitations under the License. 017 */ 018 019 package net.dpml.component; 020 021 import java.rmi.Remote; 022 import java.rmi.RemoteException; 023 024 /** 025 * The Model interfaces is used mark a object as manageable context used in 026 * the creation of a runtime handler. 027 * 028 * @author <a href="http://www.dpml.net">Digital Product Meta Library</a> 029 * @version 1.2.0 030 */ 031 public interface Model extends Remote 032 { 033 /** 034 * The constant partition separator. 035 */ 036 final String PARTITION_SEPARATOR = "/"; 037 038 /** 039 * Return the path identifying the model. A path commences with the 040 * PARTITION_SEPARATOR character and is followed by a model name. If the 041 * model exposed nested models, the path is composed of model names 042 * seaprated by the PARTITION_SEPARATOR as in "/main/web/handler". 043 * 044 * @return the context path 045 * @exception RemoteException if a remote exception occurs 046 */ 047 String getContextPath() throws RemoteException; 048 049 /** 050 * Get the activation policy. If the activation policy is STARTUP, an implementation 051 * a handler shall immidiately activation a runtime instance. If the policy is on DEMAND 052 * an implementation shall defer activiation until an explicit request is received. If 053 * the policy if SYSTEM activation may occur at the discretion of an implementation. 054 * 055 * @return the activation policy 056 * @exception RemoteException if a remote exception occurs 057 * @see ActivationPolicy#SYSTEM 058 * @see ActivationPolicy#STARTUP 059 * @see ActivationPolicy#DEMAND 060 */ 061 ActivationPolicy getActivationPolicy() throws RemoteException; 062 063 /** 064 * Set the component activation policy to the supplied value. 065 * @param policy the new activation policy 066 * @exception RemoteException if a remote I/O error occurs 067 */ 068 void setActivationPolicy( ActivationPolicy policy ) throws RemoteException; 069 070 /** 071 * Add a listener to the component model. 072 * @param listener the model listener 073 * @exception RemoteException if a remote exception occurs 074 */ 075 void addModelListener( ModelListener listener ) throws RemoteException; 076 077 /** 078 * Remove a listener from the component model. 079 * @param listener the model listener 080 * @exception RemoteException if a remote exception occurs 081 */ 082 void removeModelListener( ModelListener listener ) throws RemoteException; 083 } 084