se.kmr.scam.local
Class LocalCommon

java.lang.Object
  extended byse.kmr.scam.local.LocalCommon

public abstract class LocalCommon
extends Object

Common-class that all service-classes extend. These classes are auto-generated from the EJB-implementations. This class replaces se.kmr.scam.server.impl.BeanCommon for local usage (no application-server).

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
protected static Map m_graphIDs
           
protected static Map m_graphs
           
 
Constructor Summary
LocalCommon()
           
 
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.
 void begin()
           
protected  void close()
          Convenience method to close DB Connection
 void commit()
          Commit a transaction (end 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  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
 void rollback()
          Rollback a transaction (end failed 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


m_graphIDs

protected static Map m_graphIDs

m_graphs

protected static Map m_graphs
Constructor Detail

LocalCommon

public LocalCommon()
Method Detail

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

public void begin()
           throws SQLException
Throws:
SQLException

commit

public void commit()
            throws SQLException
Commit a transaction (end transaction). A successful commit releases the connection back to pool. If this fails, we don't release connection, try a rollback() first.

Throws:
SQLException

rollback

public void rollback()
              throws ArchiveException
Rollback a transaction (end failed transaction). A successful rollback releases the connection back to pool. If this fails, we kill the connection because it could contain inconsistent transactions -> extremely fatal error :(

Throws:
ArchiveException

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.