se.kmr.scam.server.impl
Class BeanCommon

java.lang.Object
  extended byse.kmr.scam.server.impl.BeanCommon
Direct Known Subclasses:
AdministerBean, ContentBean, ImportBean, ManifestBean, SearchBean

public abstract class BeanCommon
extends Object

Common methods shared by all EJBs. Include transaction- and access-control methods.

Title:

Description:

Copyright: Copyright (c) 2002

Company:

Version:
1.0
Author:
jand

Field Summary
static String ADMIN_ROLE
          Administrator role Key: scam.role.admin
static String GUEST_ROLE
          Guest role Key: scam.role.guest
 
Constructor Summary
BeanCommon()
           
 
Method Summary
protected  void abort(String mess)
           
protected  void assertPermission(Model model, Collection reses, Property perm)
          Assert permission.
protected  void assertPermission(Model model, Resource res, Property perm)
          Assert permission.
protected  void begin()
          Begin transaction.
protected  void close()
          Convenience method to close DB Connection
protected  void commit()
          Commit transaction
protected  boolean contains(String identity)
          See if Manifest exists
protected  ModelRDB create(String identity)
          Create a new Mainfest
protected  void filter(Model dbModel, Model model, Property perm)
          Remove all unauthorized components in Model.
protected  void filter(Model model, Property perm)
          Remove all unauthorized components in Model.
protected  String getCaller()
           
protected abstract  SessionContext getSessionContext()
          Get the sessioncontext
protected  boolean hasPermission(Model model, Collection reses, Property perm)
          Check permission.
protected  boolean hasPermission(Model model, Resource res, Property perm)
          Check permission.
protected  boolean isCaller(Object principal)
           
protected  boolean isCallerInRole(Object role)
           
protected  List list()
          List all Manifests (except DEFAULT)
protected  String lookup(Integer graphID)
          Lookup Manifest-identity by ID (used in multi-model-search)
protected  ModelRDB open()
           
protected  ModelRDB open(String identity)
          Convenience method to open a Manifest (from cache).
protected  boolean remove(String identity)
          Remove Manifest
protected  void rollback()
          Rollback transaction
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ADMIN_ROLE

public static final String ADMIN_ROLE
Administrator role Key: scam.role.admin


GUEST_ROLE

public static final String GUEST_ROLE
Guest role Key: scam.role.guest

Constructor Detail

BeanCommon

public BeanCommon()
Method Detail

getSessionContext

protected abstract SessionContext getSessionContext()
Get the sessioncontext

Returns:
the context

open

protected ModelRDB open(String identity)
                 throws ArchiveException
Convenience method to open a Manifest (from cache).

Parameters:
identity - Manifest name
Returns:
Manifest
Throws:
ArchiveException

open

protected ModelRDB open()
                 throws ArchiveException
Throws:
ArchiveException

contains

protected boolean contains(String identity)
                    throws ArchiveException
See if Manifest exists

Parameters:
identity - Manifest name
Returns:
true if found
Throws:
ArchiveException

lookup

protected String lookup(Integer graphID)
                 throws ArchiveException
Lookup Manifest-identity by ID (used in multi-model-search)

Parameters:
graphID - ID
Returns:
identity or null if not found
Throws:
ArchiveException

create

protected ModelRDB create(String identity)
                   throws ArchiveException
Create a new Mainfest

Parameters:
identity - Manifest name
Returns:
created instance (or existing)
Throws:
ArchiveException

list

protected List list()
             throws ArchiveException
List all Manifests (except DEFAULT)

Returns:
List of Strings
Throws:
ArchiveException

remove

protected boolean remove(String identity)
                  throws ArchiveException
Remove Manifest

Parameters:
identity - Manifest name
Returns:
true if successful
Throws:
ArchiveException

close

protected void close()
Convenience method to close DB Connection


abort

protected void abort(String mess)
              throws ArchiveException
Throws:
ArchiveException

begin

protected void begin()
              throws SystemException
Begin transaction.

Throws:
SystemException

commit

protected void commit()
               throws SystemException
Commit transaction

Throws:
SystemException

rollback

protected void rollback()
                 throws ArchiveException
Rollback transaction

Throws:
ArchiveException
To do:
Invalidate cache?

assertPermission

protected void assertPermission(Model model,
                                Resource res,
                                Property perm)
                         throws RDFException,
                                ArchiveException
Assert permission.

Parameters:
model - Model containing ACL for res
res - Resource
perm - Permission
Throws:
RDFException
ArchiveException - if permission not granted
See Also:
hasPermission(Model, Resource, Property)

assertPermission

protected void assertPermission(Model model,
                                Collection reses,
                                Property perm)
                         throws RDFException,
                                ArchiveException
Assert permission.

Parameters:
model - Model containing ACL for reses
reses - Resources (or URIs)
perm - Permission
Throws:
RDFException
ArchiveException - if permission not granted for one or more
See Also:
hasPermission(Model, Resource, Property)

hasPermission

protected boolean hasPermission(Model model,
                                Resource res,
                                Property perm)
                         throws RDFException
Check permission. Examines Manifest first, then the Component itself. Users in admin-role has always permission to do anything. In case the Component is a content-Item, its content-resource-ACL will be examined.

Parameters:
model - Model containing ACL for res
res - Resource
perm - Permission
Returns:
true if permission granted.
Throws:
RDFException

hasPermission

protected boolean hasPermission(Model model,
                                Collection reses,
                                Property perm)
                         throws RDFException
Check permission.

Parameters:
model - Model containing ACL for reses
reses - Resources (or URIs)
perm - Permission
Returns:
true if permission granted for all resources
Throws:
RDFException
See Also:
hasPermission(Model, Resource, Property)

filter

protected void filter(Model dbModel,
                      Model model,
                      Property perm)
               throws RDFException
Remove all unauthorized components in Model.

Parameters:
dbModel - Model (containing ACL:s)
model - Model to filter
perm - Permission
Throws:
RDFException

filter

protected void filter(Model model,
                      Property perm)
               throws RDFException
Remove all unauthorized components in Model.

Parameters:
model - Model to filter (containing ACL:s)
perm - Permission
Throws:
RDFException

getCaller

protected String getCaller()

isCaller

protected boolean isCaller(Object principal)

isCallerInRole

protected boolean isCallerInRole(Object role)


Copyright © 2003 SCAM. All Rights Reserved.