Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Codecrew
/
Moya
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
30
Merge Requests
2
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 777af13c
authored
Nov 09, 2014
by
Tuomas Riihimäki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unused files
LoggingBean is replaced by MoyaEventTopicLoggingBean
1 parent
522d6c56
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
204 deletions
code/moya-beans/ejbModule/fi/codecrew/moya/beans/JmxNotificationTestBean.java
code/moya-beans/ejbModule/fi/codecrew/moya/beans/LoggingBean.java
code/moya-beans/ejbModule/fi/codecrew/moya/beans/JmxNotificationTestBean.java
deleted
100644 → 0
View file @
522d6c5
package
fi
.
codecrew
.
moya
.
beans
;
import
java.io.IOException
;
import
javax.annotation.PostConstruct
;
import
javax.ejb.Local
;
import
javax.ejb.Singleton
;
import
javax.ejb.Startup
;
import
javax.inject.Inject
;
import
javax.management.MBeanServerConnection
;
import
javax.management.Notification
;
import
javax.management.NotificationListener
;
import
javax.management.remote.JMXConnector
;
import
javax.management.remote.JMXConnectorFactory
;
import
javax.management.remote.JMXServiceURL
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
@Singleton
@Startup
public
class
JmxNotificationTestBean
implements
NotificationListener
{
@PostConstruct
public
void
startup
()
{
// JMXConnector jcf;
// try {
// jcf = JMXConnectorFactory.connect(new JMXServiceURL(null, null, 8686));
// MBeanServerConnection mbsc = jcf.getMBeanServerConnection();
// } catch (IOException e) {
// logger.warn("Error creating jmx connection", e);
// }
}
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
JmxNotificationTestBean
.
class
);
@Override
public
void
handleNotification
(
Notification
notification
,
Object
handback
)
{
logger
.
info
(
"Handling jmx Notification, src: {}, type {}, userdata: {}"
,
new
Object
[]
{
notification
.
getSource
(),
notification
.
getType
(),
notification
.
getUserData
()
});
}
}
code/moya-beans/ejbModule/fi/codecrew/moya/beans/LoggingBean.java
deleted
100644 → 0
View file @
522d6c5
/*
* Copyright Codecrew Ry
*
* All rights reserved.
*
* This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software.
*
* Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the
* copyright owner.
*
* A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in
* future versions of the Software.
*
*/
package
fi
.
codecrew
.
moya
.
beans
;
import
java.util.Calendar
;
import
javax.annotation.Resource
;
import
javax.ejb.EJB
;
import
javax.ejb.Stateless
;
import
javax.ejb.TransactionManagement
;
import
javax.ejb.TransactionManagementType
;
import
javax.transaction.UserTransaction
;
import
org.slf4j.Logger
;
import
fi.codecrew.moya.facade.LogEntryFacade
;
import
fi.codecrew.moya.facade.LogEntryTypeFacade
;
import
fi.codecrew.moya.beans.EventBeanLocal
;
import
fi.codecrew.moya.beans.LoggingBeanLocal
;
import
fi.codecrew.moya.beans.SecurityLogType
;
import
fi.codecrew.moya.beans.moyamessage.MoyaEventSender
;
import
fi.codecrew.moya.model.EventUser
;
import
fi.codecrew.moya.model.LanEvent
;
import
fi.codecrew.moya.model.LogEntry
;
import
fi.codecrew.moya.model.LogEntryType
;
import
fi.codecrew.moya.model.User
;
/**
* Session Bean implementation class SercurityBean
*/
@Stateless
//@TransactionManagement(TransactionManagementType.BEAN)
public
class
LoggingBean
implements
LoggingBeanLocal
{
private
static
final
boolean
DEBUG
=
true
;
private
final
Logger
logger
=
org
.
slf4j
.
LoggerFactory
.
getLogger
(
LoggingBean
.
class
);
// @EJB
// private LogEntryTypeFacade typeFacade;
// @EJB
// private LogEntryFacade entryFacade;
@EJB
private
EventBeanLocal
eventbean
;
@EJB
private
MoyaEventSender
sender
;
// @Resource
// UserTransaction utx;
// @Override
// public LogEntry logPermissionDenied(User user, Exception exception) {
// LogEntry entry = null;
//
// entry = logMessage(SecurityLogType.permissionDenied, user,
// exception.getMessage());
// logger.debug(entry.toString(), exception);
//
// return entry;
//
// }
//
// public LogEntry logException(User user, Exception exception) {
//
// LogEntry entry = logMessage(SecurityLogType.unknownException, user,
// exception.getMessage());
// logger.debug(entry.toString(), exception);
// return entry;
// }
//
// public LogEntry logMessage(User user, String... description) {
//
// LogEntry entry = logMessage(SecurityLogType.genericMessage, user,
// toString(description));
//
// return entry;
// }
//
// private static final String toString(String... desc) {
// StringBuilder msg = new StringBuilder();
// for (String msgpart : desc) {
// msg.append(msgpart);
// }
// return msg.toString();
// }
//
// public LogEntry logMessage(String... description) {
// LogEntry entry = logMessage(SecurityLogType.genericMessage,
// toString(description));
// return entry;
//
// }
// public LogEntry logPermissionDenied(User currentuser, String... message)
// {
// return logMessage(SecurityLogType.permissionDenied, currentuser,
// toString(message));
// }
@Override
public
LogEntry
logMessage
(
SecurityLogType
paramType
,
LanEvent
event
,
User
user
,
Object
...
description
)
{
LogEntry
entry
=
null
;
if
(
event
==
null
)
{
event
=
eventbean
.
getCurrentEvent
();
}
try
{
String
desc
=
toString
(
description
);
logger
.
warn
(
"Sending logmsg {}"
,
desc
);
//LogEntryType type = typeFacade.findOrCreate(paramType);
// entry = new LogEntry(Calendar.getInstance());
// entry.setParentEvent(event);
// entry.setType(type);
// entry.setDescription(desc);
// entry.setUser(user);
// entryFacade.create(entry);
String
msg
=
"SECURITY DEBUG: Type: \""
+
paramType
.
name
()
+
"\" user \""
+
paramType
.
name
()
+
"\", description \""
+
((
user
==
null
)
?
"null"
:
user
.
getLogin
())
+
"\""
+
desc
;
//sender.sendMessage(msg);
// utx.commit();
}
catch
(
Exception
e
)
{
logger
.
warn
(
"Exception at SecurityBean"
,
e
);
}
return
entry
;
}
@Override
public
LogEntry
logMessage
(
SecurityLogType
paramType
,
EventUser
user
,
Object
...
description
)
{
LanEvent
event
=
null
;
User
usr
=
null
;
if
(
user
!=
null
)
{
event
=
user
.
getEvent
();
usr
=
user
.
getUser
();
}
return
logMessage
(
paramType
,
event
,
usr
,
description
);
}
private
static
final
String
toString
(
Object
...
desc
)
{
StringBuilder
msg
=
new
StringBuilder
();
for
(
Object
msgpart
:
desc
)
{
msg
.
append
(
msgpart
);
}
return
msg
.
toString
();
}
}
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment