Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Norbert Klasen
JLDAP
Commits
f6428fe7
Commit
f6428fe7
authored
Apr 23, 2004
by
Kurt Zeilenga
Browse files
Fix end-of-line terminatin
parent
560ee9f8
Changes
22
Expand all
Hide whitespace changes
Inline
Side-by-side
com/novell/ldap/events/edir/EdirEventConstant.java
View file @
f6428fe7
This diff is collapsed.
Click to expand it.
com/novell/ldap/events/edir/EdirEventIntermediateResponse.java
View file @
f6428fe7
This diff is collapsed.
Click to expand it.
com/novell/ldap/events/edir/EdirEventSource.java
View file @
f6428fe7
This diff is collapsed.
Click to expand it.
com/novell/ldap/events/edir/EdirEventSpecifier.java
View file @
f6428fe7
/* **************************************************************************
* $OpenLDAP$
*
* Copyright (C) 1999-2002 Novell, Inc. All Rights Reserved.
*
* THIS WORK IS SUBJECT TO U.S. AND INTERNATIONAL COPYRIGHT LAWS AND
* TREATIES. USE, MODIFICATION, AND REDISTRIBUTION OF THIS WORK IS SUBJECT
* TO VERSION 2.0.1 OF THE OPENLDAP PUBLIC LICENSE, A COPY OF WHICH IS
* AVAILABLE AT HTTP://WWW.OPENLDAP.ORG/LICENSE.HTML OR IN THE FILE "LICENSE"
* IN THE TOP-LEVEL DIRECTORY OF THE DISTRIBUTION. ANY USE OR EXPLOITATION
* OF THIS WORK OTHER THAN AS AUTHORIZED IN VERSION 2.0.1 OF THE OPENLDAP
* PUBLIC LICENSE, OR OTHER PRIOR WRITTEN CONSENT FROM NOVELL, COULD SUBJECT
* THE PERPETRATOR TO CRIMINAL AND CIVIL LIABILITY.
******************************************************************************/
package
com.novell.ldap.events.edir
;
/**
* This class is a bean for Specifying the Edirectory Events
* classification ,events type and event filterstring. These parameter
* are used for registering for edirectory events.
*
* <p>
* <b>Note:</b> The filterString argument is used only by
* <i>registerforFilterEvent()</i> request and the simple register
* request <i>registerforEvent()</i> ignores the same.
* </p>
*
* @see EdirEventSource#registerforEvent
* @see EdirEventSource#registerforFilterEvent
*/
public
class
EdirEventSpecifier
{
private
final
int
eventClassfication
;
private
final
int
eventType
;
private
final
String
filter
;
/**
* Constructor of the EdirEventSpecifier with Classification and Type
* specified.
*
* @param classification The Edirectory Event Classification.
* @param type The Edirectory Event Types.
*/
public
EdirEventSpecifier
(
final
int
classification
,
final
int
type
)
{
this
(
classification
,
type
,
null
);
}
/**
* Default Constructor for this class with all the input parameter.
*
* @param classification The Edirectory Event Classification.
* @param type The Edirectory Event Types.
* @param afilter The search Filter for filtering the events.
*/
public
EdirEventSpecifier
(
final
int
classification
,
final
int
type
,
final
String
afilter
)
{
eventClassfication
=
classification
;
eventType
=
type
;
filter
=
afilter
;
}
/**
* The Edirectory Event Classification Specified for this Event.
*
* @return Event Classification as int.
*/
public
int
getEventclassfication
()
{
return
eventClassfication
;
}
/**
* The Edirectory Event Type Specified for this Event.
*
* @return Event Type as int.
*/
public
int
getEventtype
()
{
return
eventType
;
}
/**
* The Edirectory Event Filter Specified for this Event.
*
* @return Filter as String.
*/
public
String
getFilter
()
{
return
filter
;
}
}
/* **************************************************************************
* $OpenLDAP$
*
* Copyright (C) 1999-2002 Novell, Inc. All Rights Reserved.
*
* THIS WORK IS SUBJECT TO U.S. AND INTERNATIONAL COPYRIGHT LAWS AND
* TREATIES. USE, MODIFICATION, AND REDISTRIBUTION OF THIS WORK IS SUBJECT
* TO VERSION 2.0.1 OF THE OPENLDAP PUBLIC LICENSE, A COPY OF WHICH IS
* AVAILABLE AT HTTP://WWW.OPENLDAP.ORG/LICENSE.HTML OR IN THE FILE "LICENSE"
* IN THE TOP-LEVEL DIRECTORY OF THE DISTRIBUTION. ANY USE OR EXPLOITATION
* OF THIS WORK OTHER THAN AS AUTHORIZED IN VERSION 2.0.1 OF THE OPENLDAP
* PUBLIC LICENSE, OR OTHER PRIOR WRITTEN CONSENT FROM NOVELL, COULD SUBJECT
* THE PERPETRATOR TO CRIMINAL AND CIVIL LIABILITY.
******************************************************************************/
package
com.novell.ldap.events.edir
;
/**
* This class is a bean for Specifying the Edirectory Events
* classification ,events type and event filterstring. These parameter
* are used for registering for edirectory events.
*
* <p>
* <b>Note:</b> The filterString argument is used only by
* <i>registerforFilterEvent()</i> request and the simple register
* request <i>registerforEvent()</i> ignores the same.
* </p>
*
* @see EdirEventSource#registerforEvent
* @see EdirEventSource#registerforFilterEvent
*/
public
class
EdirEventSpecifier
{
private
final
int
eventClassfication
;
private
final
int
eventType
;
private
final
String
filter
;
/**
* Constructor of the EdirEventSpecifier with Classification and Type
* specified.
*
* @param classification The Edirectory Event Classification.
* @param type The Edirectory Event Types.
*/
public
EdirEventSpecifier
(
final
int
classification
,
final
int
type
)
{
this
(
classification
,
type
,
null
);
}
/**
* Default Constructor for this class with all the input parameter.
*
* @param classification The Edirectory Event Classification.
* @param type The Edirectory Event Types.
* @param afilter The search Filter for filtering the events.
*/
public
EdirEventSpecifier
(
final
int
classification
,
final
int
type
,
final
String
afilter
)
{
eventClassfication
=
classification
;
eventType
=
type
;
filter
=
afilter
;
}
/**
* The Edirectory Event Classification Specified for this Event.
*
* @return Event Classification as int.
*/
public
int
getEventclassfication
()
{
return
eventClassfication
;
}
/**
* The Edirectory Event Type Specified for this Event.
*
* @return Event Type as int.
*/
public
int
getEventtype
()
{
return
eventType
;
}
/**
* The Edirectory Event Filter Specified for this Event.
*
* @return Filter as String.
*/
public
String
getFilter
()
{
return
filter
;
}
}
com/novell/ldap/events/edir/EventResponseData.java
View file @
f6428fe7
/* **************************************************************************
* $OpenLDAP$
*
* Copyright (C) 1999-2002 Novell, Inc. All Rights Reserved.
*
* THIS WORK IS SUBJECT TO U.S. AND INTERNATIONAL COPYRIGHT LAWS AND
* TREATIES. USE, MODIFICATION, AND REDISTRIBUTION OF THIS WORK IS SUBJECT
* TO VERSION 2.0.1 OF THE OPENLDAP PUBLIC LICENSE, A COPY OF WHICH IS
* AVAILABLE AT HTTP://WWW.OPENLDAP.ORG/LICENSE.HTML OR IN THE FILE "LICENSE"
* IN THE TOP-LEVEL DIRECTORY OF THE DISTRIBUTION. ANY USE OR EXPLOITATION
* OF THIS WORK OTHER THAN AS AUTHORIZED IN VERSION 2.0.1 OF THE OPENLDAP
* PUBLIC LICENSE, OR OTHER PRIOR WRITTEN CONSENT FROM NOVELL, COULD SUBJECT
* THE PERPETRATOR TO CRIMINAL AND CIVIL LIABILITY.
******************************************************************************/
package
com.novell.ldap.events.edir
;
/**
* This interface act as the placeholder used by all the Events Data as a
* common base interface.
* The interface is used as a come point for all the Data classes returned by
* the various events.
*/
public
interface
EventResponseData
{
}
/* **************************************************************************
* $OpenLDAP$
*
* Copyright (C) 1999-2002 Novell, Inc. All Rights Reserved.
*
* THIS WORK IS SUBJECT TO U.S. AND INTERNATIONAL COPYRIGHT LAWS AND
* TREATIES. USE, MODIFICATION, AND REDISTRIBUTION OF THIS WORK IS SUBJECT
* TO VERSION 2.0.1 OF THE OPENLDAP PUBLIC LICENSE, A COPY OF WHICH IS
* AVAILABLE AT HTTP://WWW.OPENLDAP.ORG/LICENSE.HTML OR IN THE FILE "LICENSE"
* IN THE TOP-LEVEL DIRECTORY OF THE DISTRIBUTION. ANY USE OR EXPLOITATION
* OF THIS WORK OTHER THAN AS AUTHORIZED IN VERSION 2.0.1 OF THE OPENLDAP
* PUBLIC LICENSE, OR OTHER PRIOR WRITTEN CONSENT FROM NOVELL, COULD SUBJECT
* THE PERPETRATOR TO CRIMINAL AND CIVIL LIABILITY.
******************************************************************************/
package
com.novell.ldap.events.edir
;
/**
* This interface act as the placeholder used by all the Events Data as a
* common base interface.
* The interface is used as a come point for all the Data classes returned by
* the various events.
*/
public
interface
EventResponseData
{
}
com/novell/ldap/events/edir/MonitorEventRequest.java
View file @
f6428fe7
/* **************************************************************************
* $OpenLDAP$
*
* Copyright (C) 1999-2002 Novell, Inc. All Rights Reserved.
*
* THIS WORK IS SUBJECT TO U.S. AND INTERNATIONAL COPYRIGHT LAWS AND
* TREATIES. USE, MODIFICATION, AND REDISTRIBUTION OF THIS WORK IS SUBJECT
* TO VERSION 2.0.1 OF THE OPENLDAP PUBLIC LICENSE, A COPY OF WHICH IS
* AVAILABLE AT HTTP://WWW.OPENLDAP.ORG/LICENSE.HTML OR IN THE FILE "LICENSE"
* IN THE TOP-LEVEL DIRECTORY OF THE DISTRIBUTION. ANY USE OR EXPLOITATION
* OF THIS WORK OTHER THAN AS AUTHORIZED IN VERSION 2.0.1 OF THE OPENLDAP
* PUBLIC LICENSE, OR OTHER PRIOR WRITTEN CONSENT FROM NOVELL, COULD SUBJECT
* THE PERPETRATOR TO CRIMINAL AND CIVIL LIABILITY.
******************************************************************************/
package
com.novell.ldap.events.edir
;
import
com.novell.ldap.LDAPException
;
import
com.novell.ldap.LDAPExtendedOperation
;
import
com.novell.ldap.LDAPExtendedResponse
;
import
com.novell.ldap.LDAPIntermediateResponse
;
import
com.novell.ldap.asn1.ASN1Enumerated
;
import
com.novell.ldap.asn1.ASN1Integer
;
import
com.novell.ldap.asn1.ASN1Sequence
;
import
com.novell.ldap.asn1.ASN1Set
;
import
com.novell.ldap.asn1.LBEREncoder
;
import
com.novell.ldap.resources.ExceptionMessages
;
import
java.io.ByteArrayOutputStream
;
import
java.io.IOException
;
/**
* This class is used for registering for Edirectory events.
* This request encodes an eventType and eventStatus, which
* are send to the Edirectory Server. The class extracts the
* above value from EdirEventSpecifier class.
*
* <p>
* The MonitorEventRequest uses the following OID:<br>
* 2.16.840.1.113719.1.27.100.79
* </p>
*
* <p>
* The responseValue has the following format:<br>
* requestValue ::= <br>
* SEQUENCE {<br>
* eventCount INTEGER,<br>
* events SET OF {eventSpecifier },<br>
* }<br>
* eventSpecifier ::= <br>
* SEQUENCE {<br>
* eventType INTEGER,<br>
* eventStatus ENUMERATED<br>
* {<br>
* AllEvents (0),<br>
* SuccessfulEvents (1),<br>
* FailedEvents (2) <br>
* }<br>
* }<br>
* </p>
*
* @see EdirEventSpecifier
*/
public
class
MonitorEventRequest
extends
LDAPExtendedOperation
{
static
{
/*
* Register the extendedresponse class which is returned by the
* server in response to a MonitorEventRequest
*/
try
{
LDAPExtendedResponse
.
register
(
EdirEventConstant
.
NLDAP_MONITOR_EVENTS_RESPONSE
,
Class
.
forName
(
"com.novell.ldap.events.edir.MonitorEventResponse"
)
);
///CLOVER:OFF
}
catch
(
ClassNotFoundException
e
)
{
System
.
err
.
println
(
"Could not register Extended Response -"
+
" Class not found"
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
///CLOVER:ON
}
//Also try to register EdirEventIntermediateResponse
try
{
LDAPIntermediateResponse
.
register
(
EdirEventConstant
.
NLDAP_EVENT_NOTIFICATION
,
Class
.
forName
(
EdirEventIntermediateResponse
.
class
.
getName
()
)
);
///CLOVER:OFF
}
catch
(
ClassNotFoundException
e
)
{
System
.
err
.
println
(
"Could not register LDAP Intermediate Response -"
+
" Class not found"
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
///CLOVER:ON
}
}
/**
* Default Constructor for the Monitor Event Request Used to Send a
* Monitor Event Request to LDAPServer.
*
* @param specifiers The list of EdirEventSpecifiers to send to
* server.
*
* @throws LDAPException When the data encoding fails.
*/
public
MonitorEventRequest
(
final
EdirEventSpecifier
[]
specifiers
)
throws
LDAPException
{
super
(
EdirEventConstant
.
NLDAP_MONITOR_EVENTS_REQUEST
,
null
);
if
((
specifiers
==
null
))
{
throw
new
IllegalArgumentException
(
ExceptionMessages
.
PARAM_ERROR
);
}
ByteArrayOutputStream
encodedData
=
new
ByteArrayOutputStream
();
LBEREncoder
encoder
=
new
LBEREncoder
();
ASN1Sequence
asnsequence
=
new
ASN1Sequence
();
try
{
asnsequence
.
add
(
new
ASN1Integer
(
specifiers
.
length
));
ASN1Set
asnset
=
new
ASN1Set
();
for
(
int
i
=
0
;
i
<
specifiers
.
length
;
i
++)
{
ASN1Sequence
specifiersequence
=
new
ASN1Sequence
();
specifiersequence
.
add
(
new
ASN1Integer
(
specifiers
[
i
].
getEventclassfication
())
);
specifiersequence
.
add
(
new
ASN1Enumerated
(
specifiers
[
i
].
getEventtype
())
);
asnset
.
add
(
specifiersequence
);
}
asnsequence
.
add
(
asnset
);
asnsequence
.
encode
(
encoder
,
encodedData
);
}
catch
(
IOException
e
)
{
throw
new
LDAPException
(
ExceptionMessages
.
ENCODING_ERROR
,
LDAPException
.
ENCODING_ERROR
,
(
String
)
null
);
}
setValue
(
encodedData
.
toByteArray
());
}
}
/* **************************************************************************
* $OpenLDAP$
*
* Copyright (C) 1999-2002 Novell, Inc. All Rights Reserved.
*
* THIS WORK IS SUBJECT TO U.S. AND INTERNATIONAL COPYRIGHT LAWS AND
* TREATIES. USE, MODIFICATION, AND REDISTRIBUTION OF THIS WORK IS SUBJECT
* TO VERSION 2.0.1 OF THE OPENLDAP PUBLIC LICENSE, A COPY OF WHICH IS
* AVAILABLE AT HTTP://WWW.OPENLDAP.ORG/LICENSE.HTML OR IN THE FILE "LICENSE"
* IN THE TOP-LEVEL DIRECTORY OF THE DISTRIBUTION. ANY USE OR EXPLOITATION
* OF THIS WORK OTHER THAN AS AUTHORIZED IN VERSION 2.0.1 OF THE OPENLDAP
* PUBLIC LICENSE, OR OTHER PRIOR WRITTEN CONSENT FROM NOVELL, COULD SUBJECT
* THE PERPETRATOR TO CRIMINAL AND CIVIL LIABILITY.
******************************************************************************/
package
com.novell.ldap.events.edir
;
import
com.novell.ldap.LDAPException
;
import
com.novell.ldap.LDAPExtendedOperation
;
import
com.novell.ldap.LDAPExtendedResponse
;
import
com.novell.ldap.LDAPIntermediateResponse
;
import
com.novell.ldap.asn1.ASN1Enumerated
;
import
com.novell.ldap.asn1.ASN1Integer
;
import
com.novell.ldap.asn1.ASN1Sequence
;
import
com.novell.ldap.asn1.ASN1Set
;
import
com.novell.ldap.asn1.LBEREncoder
;
import
com.novell.ldap.resources.ExceptionMessages
;
import
java.io.ByteArrayOutputStream
;
import
java.io.IOException
;
/**
* This class is used for registering for Edirectory events.
* This request encodes an eventType and eventStatus, which
* are send to the Edirectory Server. The class extracts the
* above value from EdirEventSpecifier class.
*
* <p>
* The MonitorEventRequest uses the following OID:<br>
* 2.16.840.1.113719.1.27.100.79
* </p>
*
* <p>
* The responseValue has the following format:<br>
* requestValue ::= <br>
* SEQUENCE {<br>
* eventCount INTEGER,<br>
* events SET OF {eventSpecifier },<br>
* }<br>
* eventSpecifier ::= <br>
* SEQUENCE {<br>
* eventType INTEGER,<br>
* eventStatus ENUMERATED<br>
* {<br>
* AllEvents (0),<br>
* SuccessfulEvents (1),<br>
* FailedEvents (2) <br>
* }<br>
* }<br>
* </p>
*
* @see EdirEventSpecifier
*/
public
class
MonitorEventRequest
extends
LDAPExtendedOperation
{
static
{
/*
* Register the extendedresponse class which is returned by the
* server in response to a MonitorEventRequest
*/
try
{
LDAPExtendedResponse
.
register
(
EdirEventConstant
.
NLDAP_MONITOR_EVENTS_RESPONSE
,
Class
.
forName
(
"com.novell.ldap.events.edir.MonitorEventResponse"
)
);
///CLOVER:OFF
}
catch
(
ClassNotFoundException
e
)
{
System
.
err
.
println
(
"Could not register Extended Response -"
+
" Class not found"
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
///CLOVER:ON
}
//Also try to register EdirEventIntermediateResponse
try
{
LDAPIntermediateResponse
.
register
(
EdirEventConstant
.
NLDAP_EVENT_NOTIFICATION
,
Class
.
forName
(
EdirEventIntermediateResponse
.
class
.
getName
()
)
);
///CLOVER:OFF
}
catch
(
ClassNotFoundException
e
)
{
System
.
err
.
println
(
"Could not register LDAP Intermediate Response -"
+
" Class not found"
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
///CLOVER:ON
}
}
/**
* Default Constructor for the Monitor Event Request Used to Send a
* Monitor Event Request to LDAPServer.
*
* @param specifiers The list of EdirEventSpecifiers to send to
* server.
*
* @throws LDAPException When the data encoding fails.
*/
public
MonitorEventRequest
(
final
EdirEventSpecifier
[]
specifiers
)
throws
LDAPException
{
super
(
EdirEventConstant
.
NLDAP_MONITOR_EVENTS_REQUEST
,
null
);
if
((
specifiers
==
null
))
{
throw
new
IllegalArgumentException
(
ExceptionMessages
.
PARAM_ERROR
);
}
ByteArrayOutputStream
encodedData
=
new
ByteArrayOutputStream
();
LBEREncoder
encoder
=
new
LBEREncoder
();
ASN1Sequence
asnsequence
=
new
ASN1Sequence
();
try
{
asnsequence
.
add
(
new
ASN1Integer
(
specifiers
.
length
));
ASN1Set
asnset
=
new
ASN1Set
();
for
(
int
i
=
0
;
i
<
specifiers
.
length
;
i
++)
{
ASN1Sequence
specifiersequence
=
new
ASN1Sequence
();
specifiersequence
.
add
(
new
ASN1Integer
(
specifiers
[
i
].
getEventclassfication
())
);
specifiersequence
.
add
(
new
ASN1Enumerated
(
specifiers
[
i
].
getEventtype
())
);
asnset
.
add
(
specifiersequence
);
}
asnsequence
.
add
(
asnset
);
asnsequence
.
encode
(
encoder
,
encodedData
);
}
catch
(
IOException
e
)
{
throw
new
LDAPException
(
ExceptionMessages
.
ENCODING_ERROR
,
LDAPException
.
ENCODING_ERROR
,
(
String
)
null
);
}
setValue
(
encodedData
.
toByteArray
());
}
}
com/novell/ldap/events/edir/MonitorEventResponse.java
View file @
f6428fe7
/* **************************************************************************
* $OpenLDAP$
*
* Copyright (C) 1999-2002 Novell, Inc. All Rights Reserved.
*
* THIS WORK IS SUBJECT TO U.S. AND INTERNATIONAL COPYRIGHT LAWS AND
* TREATIES. USE, MODIFICATION, AND REDISTRIBUTION OF THIS WORK IS SUBJECT
* TO VERSION 2.0.1 OF THE OPENLDAP PUBLIC LICENSE, A COPY OF WHICH IS
* AVAILABLE AT HTTP://WWW.OPENLDAP.ORG/LICENSE.HTML OR IN THE FILE "LICENSE"
* IN THE TOP-LEVEL DIRECTORY OF THE DISTRIBUTION. ANY USE OR EXPLOITATION
* OF THIS WORK OTHER THAN AS AUTHORIZED IN VERSION 2.0.1 OF THE OPENLDAP
* PUBLIC LICENSE, OR OTHER PRIOR WRITTEN CONSENT FROM NOVELL, COULD SUBJECT
* THE PERPETRATOR TO CRIMINAL AND CIVIL LIABILITY.
******************************************************************************/
package
com.novell.ldap.events.edir
;
import
com.novell.ldap.LDAPException
;
import
com.novell.ldap.LDAPExtendedResponse
;
import
com.novell.ldap.asn1.ASN1Enumerated
;
import
com.novell.ldap.asn1.ASN1Integer
;
import
com.novell.ldap.asn1.ASN1Sequence
;
import
com.novell.ldap.asn1.ASN1Set
;
import
com.novell.ldap.asn1.LBERDecoder
;
import
com.novell.ldap.rfc2251.RfcLDAPMessage
;
/**
* This object represents the ExtendedResponse returned when Event
* Registeration fails. This Extended Response structure is generated for
* requests send as MonitorEventRequest or MonitorFilterEventRequest.
*