com.jalios.jcms
Class Channel

java.lang.Object
  extended by com.jalios.jcms.Channel
All Implemented Interfaces:
JcmsConstants, JaliosConstants, JPropertiesListener

public class Channel
extends Object
implements JcmsConstants, JPropertiesListener

The Channel singleton is the main access point of the JCMS API.
This singleton is initialized automatically on startup by the servlet ChannelInitServlet declared in web.xml.

The following methods of Channel may be useful for your developments in JCMS.

  • Retrieving data from JCMS

  • Listeners, Data Controllers RightPolicyFilter, Query Filters and Authentication Handlers

  • Accessing Properties and Language Properties

    The JCMS API provides simple methods to read properties from configuration files and from languages files.
    As of version 5.5.0 JCMS does not yet differentiate configuration properties from languages properties.
  • Updating and saving properties methods

    Should you need to change any of your custom properties, you can use some methods listed below. We do not support the use of the following methods to change any JCMS property at runtime, behaviour of JCMS maybe incorrect if you do not use the user interface for such task.
  • Converting relative path to File

    Use the following methods to easely convert relative path into Files and vice-versa. Useful for configuration files, uploaded files, file manipulations, etc.
        File confFile = new File(channel.getDataPath("conf.xml"));
        ...
      
  • Communicating by email

    Use those method to retrieve the correct sender to use when sending an email from your java code.
        String sender = channel.getSenderFullEmail();
        Strint recipient = newMbr.getFullEmail();
        String subject = "[" + channel.getName() + "] " + "Welcome!"; // TO DO: I18N
        String content = "Welcome " + newMbr.getFriendlyName() + "\nEnjoy our new site!"; // TO DO: I18N
        MailUtil.sendMail(sender, recipient, subject, content);
      
  • Store Manipulation

    WARNING: Modifying the Store can be very dangerous!!! Only use the following methods if you fully understand their behaviour and their consequences.

  • Others methods of the Channel should be used wisely even though they are public.

    Version:
    $Revision: 22762 $

    Nested Class Summary
     class Channel.TypeLabelComparator
              Sort type according their label in a given language.
     
    Field Summary
    protected  boolean adminIpNoPattern
               
    protected  org.apache.oro.text.regex.Pattern adminIpPattern
               
    protected  Set<Category> advRefineRootSet
               
    protected  Map<String,AlarmManager> alarmManagerMap
               
    protected  HashMap<Class<?>,Map<String,TypeFieldEntry>> allTypeFieldEntriesCacheMap
               
    protected  AppServerInfo appServerInfo
               
    protected  AuthenticationManager authMgr
               
    protected  CacheManager cacheManager
               
    protected static Channel channel
               
    protected  TreeSet<ChannelListener> channelListenerSet
               
    protected  Map<Class<? extends Data>,Set<Data>> class2dataSet
               
    protected  ClassLoader classLoader
               
    protected  List<CustomCleanFilter> cleanFilterList
               
    protected  javax.servlet.ServletContext context
               
    protected  ArrayList<Class<? extends Publication>> coreTypeList
               
    protected  int cryptAlgo
               
    protected  ThreadLocal<javax.servlet.http.HttpServletRequest> currentServletRequest
               
    protected  ThreadLocal<javax.servlet.http.HttpServletResponse> currentServletResponse
               
    protected  String customPropFilePath
               
    protected  Set<Member> dailyAlert
               
    protected  HashMap<Class<?>,Set<DataController>> dataControllerMap
               
    protected  TreeMap<Data,ControllerStatus> dataIntegrityReport
               
    protected  Date dataIntegrityReportDate
               
    protected  DataListener dataListener
               
    protected  SimpleDateFormat dateFormat
               
    protected  HashMap<String,SimpleDateFormat> dateFormatMap
               
    protected  SimpleDateFormat dateTimeFormat
               
    protected  HashMap<String,SimpleDateFormat> dateTimeFormatMap
               
    protected  Member defaultAdmin
               
    protected  String defaultEmail
               
    protected  Group defaultGroup
               
    protected  String[] defaultQueryTypes
               
    protected  String[] defaultQueryTypesOff
               
    protected  Workspace defaultWorkspace
               
    protected  HashMap<Class<?>,Map<String,TypeFieldEntry>> exactTypeFieldEntriesCacheMap
               
    protected  FileIndexManager fim
               
    protected  HashMap<String,String> ipToReverseProxyConfNameMap
               
    protected  boolean isAvailable
               
    protected  boolean isDataWriteEnabled
               
    protected  boolean isDataWriteEnabledComputed
               
    protected  boolean isDeployManagerEnabled
               
    protected  boolean isGzipCompressionEnabled
               
    protected  boolean isNotificationEnabled
               
    protected  boolean isRemotePortalsAuthenticationEnabled
               
    protected  boolean isReverseProxyEnabled
               
    protected static boolean isSSLenabled
               
    protected  boolean isUsingAdvancedI18N
               
    protected  boolean isWebdavEnable
               
    protected  boolean isWebdavEnableComputed
               
    protected  JcmsInfo jcmsInfo
               
    protected  ArrayList<String> jcmsLangList
               
    protected  boolean jsyncAutoUpdate
               
    protected  long jsyncDownloadInterval
               
    protected  boolean jsyncEnabled
               
    protected  String jsyncExplicitReplicaList
               
    protected  boolean jsyncHasLeader
               
    protected  org.apache.oro.text.regex.Pattern jsyncIpPattern
               
    protected  String jsyncLeaderUrl
               
    protected  JSyncPreviousReplicaManager jsyncPreviousReplicaManager
               
    protected  JSyncReplica jsyncReplica
               
    protected  String jsyncReplicaUrl
               
    protected  long jsyncStabDelay
               
    protected  boolean jsyncSuggestJoin
               
    protected  boolean jsyncSyncFiles
               
    protected  String jsyncUpdateMode
               
    protected  ArrayList<String> langList
               
    protected  ArrayList<String> langListOrdered
               
    protected  String language
               
    protected  LDAPConfiguration ldapConf
               
    protected  LinkIndexManager lim
               
    protected  LimitController limitController
               
    protected  Locale locale
               
    protected  ArrayList<String> localizedLangList
               
    protected  long lockTimeout
               
    protected  String logFilePath
               
    protected  Set<Member> monthlyAlert
               
    protected  String name
               
    protected  AlarmEntry nlAlarmEntry
               
    protected  CategoryRight noCategoryRight
               
    protected  NotificationManager notificationManager
               
    protected  ArrayList<String> otherLangList
               
    protected  PolicyManager policyManager
               
    protected  LangProperties properties
               
    protected  Class<?>[] publicationSuperTypes
               
    protected  Map<String,List<Class<? extends Publication>>> publicationTypeMap
               
    protected  PublicationListener pubListener
               
    protected  Set<Publication> pubWithoutCategories
               
    protected  QueryManager queryMgr
               
    protected  int realPathLength
               
    protected  Set<Category> refineRootSet
               
    protected  String remotePortalsIpAddress
               
    protected  org.apache.oro.text.regex.Pattern remotePortalsIpAddressPattern
               
    protected  HashMap<String,String> reverseProxyBaseURL
               
    protected  HashMap<String,String> reverseProxyContextPath
               
    protected  HashMap<String,String> reverseProxySSLBaseURL
               
    static String REVISION
               
    protected  HashSet<String> rightToLeftLanguageSet
               
    protected  Category rootCategory
               
    protected  Set<Category> rootCategoryAsSet
               
    protected  CategoryRight rootCategoryRight
               
    protected  Set<Category> searchRootSet
               
    protected  String securedUrl
               
    protected static int SSLport
               
    protected  StatReportListener statReportListener
               
    protected  Store store
               
    protected  File storeBackupDir
               
    protected  int storeBackupMax
               
    protected  TypeProcessor typeProcessor
               
    protected  String uri
               
    protected  String urid
               
    protected  String url
               
    protected  HashMap<Storable,String> virtualIDMap
               
    protected  int[] visiblePstatus
               
    protected  File webappDir
               
    protected  String webappPropFilePath
               
    protected  String webdavEncoding
               
    protected  Set<Member> weeklyAlert
               
     
    Fields inherited from interface com.jalios.jcms.JcmsConstants
    ADATE_SEARCH, ADMIN_NOTES_PROP, ADVANCED_TAB, ARCHIVES_DIR, ASCII_WIDTH, CATEGORY_TAB, CDATE_SEARCH, COMMON_ALARM, CONTENT_TAB, COOKIE_MAX_AGE, CRYPT_MD5, CRYPT_UNDEFINED, CRYPT_UNIX, CTRL_TOPIC_INTERNAL, CTRL_TOPIC_REF, CTRL_TOPIC_VALUE, CTRL_TOPIC_WRITE, CUSTOM_PROP, DAILY_MAIL_ALERT, DOCCHOOSER_HEIGHT, DOCCHOOSER_WIDTH, DOCS_DIR, EDATE_SEARCH, EMAIL_REGEXP, ERROR_MSG, FORBIDDEN_FILE_ACCESS, FORBIDDEN_REDIRECT, FORCE_REDIRECT, ICON_ARCHIVE, ICON_LOCK, ICON_LOCK_STRONG, ICON_WARN, ICON_WH_BOOK_CLOSED, ICON_WH_BOOK_OPEN, INFORMATION_MSG, JALIOS_JUNIT_PROP, JCMS_CADDY, JSYNC_DOWNLOAD_DIR, JSYNC_SYNC_ALARM, LOG_FILE, LOG_TOPIC_SECURITY, LOGGER_PROP, LOGGER_XMLPROP, MBR_PHOTO_DIR, MDATE_SEARCH, MONITOR_XML, MONTHLY_MAIL_ALERT, NO_MAIL_ALERT, OP_CREATE, OP_DEEP_COPY, OP_DEEP_DELETE, OP_DELETE, OP_MERGE, OP_UPDATE, PDATE_SEARCH, PHOTO_LARGE_HEIGHT, PHOTO_LARGE_WIDTH, PHOTO_SMALL_HEIGHT, PHOTO_SMALL_WIDTH, PHOTO_TINY_HEIGHT, PHOTO_TINY_WIDTH, PREVIOUS_TAB, PRINT_VIEW, PRIVATE_FILE_ACCESS, PUBLIC_FILE_ACCESS, READ_RIGHT_TAB, SDATE_SEARCH, SEARCHENGINE_ALARM, STATS_REPORT_DIR, STATUS_PROP, STORE_XML, TEMPLATE_TAB, THUMBNAIL_LARGE_HEIGHT, THUMBNAIL_LARGE_WIDTH, THUMBNAIL_SMALL_HEIGHT, THUMBNAIL_SMALL_WIDTH, UDATE_SEARCH, UPDATE_RIGHT_TAB, UPLOAD_DIR, URL_REGEXP, WARNING_MSG, WEBAPP_PROP, WEEKLY_MAIL_ALERT, WFEXPRESS_ALARM, WFREMINDER_ALARM, WORKFLOW_TAB, WORKFLOW_XML
     
    Fields inherited from interface com.jalios.util.JaliosConstants
    CRLF, MILLIS_IN_ONE_DAY, MILLIS_IN_ONE_HOUR, MILLIS_IN_ONE_MINUTE, MILLIS_IN_ONE_MONTH, MILLIS_IN_ONE_SECOND, MILLIS_IN_ONE_WEEK, MILLIS_IN_ONE_YEAR
     
    Method Summary
     void addAuthenticationHandler(AuthenticationHandler authHandler)
              Add the specified AuthenticationHandler to the list of AuthenticationHandlers used by the AuthenticationManager to process users' authentication.
     void addChannelListener(ChannelListener listener)
              Adds a ChannelListener.
     void addCleanFilter(CustomCleanFilter filter)
              Adds a custom clean filter.
     void addDataController(DataController dc, Class<?> clazz)
              Add the given DataController
     void addDBListener(DBListener listener)
              Add a DBListener to listen to all the Data.
     void addDBListener(DBListener listener, Class<?> clazz)
              Add a DBListener to listen to the given class of data.
     void addPolicyFilter(PolicyFilter pf)
              Add the given PolicyFilter to the list of RightPolicyFilter used by the PolicyManager (getPolicyManager()).
     void addPropertiesListener(JPropertiesListener listener)
              Adds a properties listener.
     void addQueryFilter(QueryFilter qf)
              Add the given QueryFilter to the list of QueryFilters used by the QueryManager (getQueryManager()).
     void addStoreListener(StoreListener listener, boolean repeat)
              Adds a StoreListener for all storable classes.
     void addStoreListener(StoreListener listener, Class<?> clazz, boolean repeat)
              Adds a StoreListener associated to a given class.
     void appendMilestone(String text)
              Appends a milestone in the store.
     boolean canMemberAccessFile(String filename, Member member)
              Check if the given member can access the given file (dangling documents are checked, see checkMemberAccessFile()).
     int checkMemberAccessFile(String filename, Member member, boolean checkDanglingDocument)
              Check the access mode the given member has for the given file
     void cleanStore(CleanFilter filter, JcmsContext context)
              Cleans the store.
     void clearCurrentServletRequest()
              Removes the current servlet request of the thread.
     void clearCurrentServletResponse()
              Removes the current servlet response of the thread.
     boolean containsProperty(String name)
              Tests if this JProperties contains the given property key/name.
     void createData(Data data, Member opAuthor)
              Creates a data in the store.
     String crypt(String str)
              Encrypt the given string with the encryption algorithm defined by channel.crypt property (default algorithm is Unix crypt)
     void deleteData(Data data, Member opAuthor)
              Delete a data in the store.
    protected static void destroy()
              Singleton Method to finaliez and destroy the channel.
     void disableDataWrite(String msg)
              Disable data write.
     void enableDataWrite()
              Enable data wirte.
    protected  void finalize()
              Handles the finalize invocation
     void fireChannelFinalize()
              Call method ChannelListener.handleFinalize() of every registered ChannelListener.
     void generateLogFromMemory()
              Generates a cleaned version of the store.
     PortalElement getAdminNewsletter()
              Returns the portlet to use for the newsletter as specified by the id in the property "newsletter.portlet".
     Set<Category> getAdvRefineRootSet()
              Returns the categories to used as roots for the advanced refinement.
     AlarmManager getAlarmManager(String name)
              Returns the AlarmManager associated to the given name.
     TreeSet<Data> getAllDataSet()
              Returns all the data of this site in a new TreeSet.
    <T> TreeSet<T>
    getAllDataSet(Class<T> clazz)
              Returns all instances of a given class and it's subclass.
    <T extends Publication>
    TreeSet<T>
    getAllPublicationSet(Class<T> clazz, Member member)
              Returns all publications of a given class AND subclasses that can be accessed by a given member and that are in a visible state.
    <T extends Publication>
    TreeSet<T>
    getAllPublicationSet(Class<T> clazz, Member member, boolean checkPstatus)
              Returns all publications of a given class AND subclasses that can be accessed by a given member.
     TypeFieldEntry[] getAllTypeFieldEntries(Class<?> clazz)
              Return an array of TypeFieldEntry bound to given Class.
     TypeFieldEntry[] getAllTypeFieldEntries(String className)
              Return an array of TypeFieldEntry bound to given Class name.
     AppServerInfo getAppServerInfo()
              Return the AppServerInfo instance (a singleton) which describe the underlying application server.
     AuthenticationManager getAuthMgr()
              Returns the current AuthenticationManager instance used by JCMS to authenticate members into JCMS.
     boolean getBooleanProperty(String name, boolean defaultValue)
              Gets the value of a property as a boolean given its key/name.
     CacheManager getCacheManager()
               
     Category getCategory(String id)
              Returns a category from its id
     CategoryRight getCategoryRight(HashSet<Category> roots, int mode, boolean create)
              Returns the CategoryRight matching the given criteria
    static Channel getChannel()
              Singleton Method to get the channel
     JProperties getChannelProperties()
              Returns the internal properties used by channel.
     Class getClass(String className)
              Load and return a class
     Class[] getClass(String[] clazzStr)
              Load and return classes
     ClassLoader getClassLoader()
              Returns the classLoader
     String getCleanFilename(String filename)
              Clean the given filename.
     List<CustomCleanFilter> getCleanFilterList()
              Returns the list of custom clean filters.
     AlarmManager getCommonAlarmManager()
              Returns the common AlarmManager.
     Set<Group> getCommonGroupSet()
              Return all the global groups
     ArrayList<Class<? extends Publication>> getCoreTypeList()
              Returns all the available core publication types (Review, FileDocument, ArchivedPublication...)
     Member getCurrentDelegateMember()
              Returns the original Member of the current session if he has connected to another account since then (using JCMS_sulogin feature).
     JcmsContext getCurrentJcmsContext()
              Returns the JcmsContext of the current servlet request of the current thread.
     Member getCurrentLoggedMember()
              Returns the Member currently loggued in for the current request.
     javax.servlet.http.HttpServletRequest getCurrentServletRequest()
              Returns the current servlet request.
     javax.servlet.http.HttpServletResponse getCurrentServletResponse()
              Returns the current servlet response.
     String getCurrentUserLang()
              Returns the user language if it is available (i.e. if called during a user request).