|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
Virus Scan Provider service main class.
This is the main service interface of the JAVA service
"Virus Scan Provider".
It provides access to external virus scan products (VSA) by SAP.
More detailed information about how to integrate the Virus Scan into own developed applications can be found in SAP Note 817623.
Questions about own virus scan implementions can be posted into the SAP Developer Network (SDN) in the Security Forum.
Note:
This service main class will provide a scan Instance to the
callee or null.
The return of
null means that the requested Profile is not active, which further means
that a virus scan should not be performed.
A returned instance handle must be released at the end.
So you have to work with a try/catch block and release the instance in
the finally block. Call here
releaseInstance(Instance vsInstance)
VSIService vsiService=null;
Context ctx = new InitialContext();
// The lookup for the interface reference.
Object obj = ctx.lookup(VSIService.JNDI_NAME);
if(obj==null) // service not started
return;
else
vsiService = (VSIService)obj;
Instance vsiInstance=null;
try {
// get the instance by an own defined profile
vsiInstance = vsiService.getInstance("ZMyScanProfile");
if(vsiInstance==null) // the profile "ZMyScanProfile"
return; // is not active, which means
// no scan action should be done!!!
// we got a instance therefore perform here any scan/clean
vsiInstance.scanBytes(Virus.EICAR); // for example
} catch( Exception e ) {
// we catch all. normally these exceptions would be thrown.
// -- VirusScanException
// -- VirusInfectionException
// -- VSIServiceException
// log the exception
String errorText = e.getLocalizedMessage();
} finally {
// release instance if service is started
if(vsiService!=null)
vsiService.releaseInstance(vsiInstance);
}
Copyright
This software is the confidential and proprietary information of SAP AG, Walldorf. You shall not disclose such Confidential Information and shall use it only in accordance with the terms of the license agreement you entered into with SAP.
Copyright (c) 2004-2006 SAP AG. All rights reserved.
History:
1.0 Initial Version for SAP NetWeaver 04
1.1 Added a pattern for clean test.
1.5 Enhancements in the native VSI layer
1.6 Dual runtime support (JAVA standalone and J2EE)
Instance| Field Summary | |
static java.lang.String |
JNDI_NAME
The name of the VSI Service in the SAP J2EE Engine. |
static java.lang.String |
JVSI_NAME
The name of the java virus scan interface (VSI) |
static int |
VSIMajorVersion
This information can be used for features in the future |
static int |
VSIMinorVersion
This information can be used for features in the future |
| Method Summary | |
Group |
getGroup()
Get the default group object. |
Group |
getGroup(int vsIndex)
Get a group object. |
Group |
getGroup(java.lang.String vsGroupName)
Get a group object. |
java.lang.String[] |
getGroups()
Return a String[] array containing the names of the groups which are configured. |
Instance |
getInstance()
Get a scan instance from the default scan profile. |
Instance |
getInstance(int vsIndex)
Get a scan instance from scan profile. |
Instance |
getInstance(java.lang.String vsProfileName)
Get a scan instance from scan profile. |
Instance |
getInstanceByGroup()
Get a scan instance from either the default scan group. |
Instance |
getInstanceByGroup(int vsIndex)
Get a scan instance from scan group. |
Instance |
getInstanceByGroup(java.lang.String vsGroupName)
Get a scan instance from scan group. |
Instance |
getInstanceByProvider()
Get a scan instance from the default provider. |
Instance |
getInstanceByProvider(int vsIndex)
Get a scan instance from scan provider. |
Instance |
getInstanceByProvider(java.lang.String vsProviderName)
Get a scan instance from scan provider. |
Profile |
getProfile()
Get the default scan profile. |
Profile |
getProfile(int vsIndex)
Get a profile object. |
Profile |
getProfile(java.lang.String vsProfileName)
Get the requested profile object. |
java.lang.String[] |
getProfiles()
Return a String[] array containing the names of the profiles which are available (active and not active). |
Provider |
getProvider()
Get the default provider. |
Provider |
getProvider(int vsIndex)
Get the provider object. |
Provider |
getProvider(java.lang.String vsProviderName)
Get the requested provider object. |
java.lang.String[] |
getProviders()
Return a String[] array containing the names of the providers which are active (means available). |
void |
releaseInstance(Instance vsInstance)
Release the instance back to the instance pool. |
| Field Detail |
public static final int VSIMajorVersion
public static final int VSIMinorVersion
public static final java.lang.String JNDI_NAME
public static final java.lang.String JVSI_NAME
| Method Detail |
public java.lang.String[] getProviders()
public java.lang.String[] getGroups()
public java.lang.String[] getProfiles()
String[] object of profile names
public Group getGroup(int vsIndex)
throws VSIServiceException
vsIndex - Index of the group.VSIServiceException - All other problems.Group
public Group getGroup(java.lang.String vsGroupName)
throws VSIServiceException
vsGroupName - Name of the group.VSIServiceException - Group
public Group getGroup()
throws VSIServiceException
VSIServiceException - All other problems.Group
public Provider getProvider(int vsIndex)
throws VSIServiceException
vsIndex - Index of the provider in the list.VSIServiceException - Provider
public Provider getProvider(java.lang.String vsProviderName)
throws VSIServiceException
vsProviderName - Name of the provider to be returned.VSIServiceException - All other problems.Provider
public Provider getProvider()
throws VSIServiceException
VSIServiceException - All other problems.Provider
public Profile getProfile(int vsIndex)
throws VSIServiceException
vsIndex - Index of the profile in the list.VSIServiceException - All other problems.Profile
public Profile getProfile(java.lang.String vsProfileName)
throws VSIServiceException
vsProfileName - Name of the ProfileVSIServiceException - All other problems.Profile
public Profile getProfile()
throws VSIServiceException
ProfileVSIServiceException - Profile
public Instance getInstance()
throws VSIServiceException
VSIServiceException - All other problems.
getInstance(String)
public Instance getInstance(java.lang.String vsProfileName)
throws VSIServiceException
This behaviour is wanted. If a profile is "not active" then you will get here null and should return in your own scan method. If you receive a handle != null then you "should" perform a scan action here.
Therefore this different behaviour should act as on/off switch for a virus scan action.
Note: This is the only method which might return null. All other methods wont return null but will throw an exception.
vsProfileName - Name of the pref-configured scan profile. A virus scan
profile contains at least one scan group and/or profile
to provide your own security workflow and
load balancing mechanism.VSIServiceException - All other problems.
public Instance getInstance(int vsIndex)
throws VSIServiceException
vsIndex - Index of the scan profile.VSIServiceException - All other problems.getInstanceByGroup(String)
public Instance getInstanceByGroup()
throws VSIServiceException
VSIServiceException - All other problems.getInstanceByGroup(String)
public Instance getInstanceByGroup(java.lang.String vsGroupName)
throws VSIServiceException
vsGroupName - Name of the pref-configured scan group. A virus scan
group contains several scan providers to provide a
load balancing mechanism.VSIServiceException - All other problems.
public Instance getInstanceByGroup(int vsIndex)
throws VSIServiceException
vsIndex - Index of the scan group.VSIServiceException - All other problems.getInstanceByGroup(String)
public Instance getInstanceByProvider()
throws VSIServiceException
VSIServiceException - All other problems.getInstanceByProvider(String)
public Instance getInstanceByProvider(java.lang.String vsProviderName)
throws VSIServiceException
vsProviderName - Name of the pref-configured provider. A virus scan
provider can either be a Virus Scan Server or a
virus scan adapter. The last one needs a native
adapter library.VSIServiceException - All other problems.
public Instance getInstanceByProvider(int vsIndex)
throws VSIServiceException
vsIndex - Index of the provider to be returned.VSIServiceException - All other problems.getInstanceByProvider(String)public void releaseInstance(Instance vsInstance)
Note: Call this method always in the finally block. You can also pass null instance handles, therefore you should call this method in any cases after you have requested for an instance object.
vsInstance - Instance object to be released.Instance
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||