summaryrefslogtreecommitdiff
path: root/source/com/c2kernel/entity/CorbaServer.java
diff options
context:
space:
mode:
Diffstat (limited to 'source/com/c2kernel/entity/CorbaServer.java')
-rw-r--r--source/com/c2kernel/entity/CorbaServer.java45
1 files changed, 22 insertions, 23 deletions
diff --git a/source/com/c2kernel/entity/CorbaServer.java b/source/com/c2kernel/entity/CorbaServer.java
index 883bb1b..84d2ef2 100644
--- a/source/com/c2kernel/entity/CorbaServer.java
+++ b/source/com/c2kernel/entity/CorbaServer.java
@@ -39,7 +39,7 @@ public class CorbaServer {
public CorbaServer() throws InvalidDataException {
mEntityCache = new SoftCache<EntityPath, Servant>(50);
-
+
// init POA
try {
setupPOA();
@@ -48,15 +48,16 @@ public class CorbaServer {
Logger.error(ex);
throw new InvalidDataException("Error initialising POA", "");
}
-
+
new Thread(new Runnable() {
- public void run() {
+ @Override
+ public void run() {
Thread.currentThread().setName("ORB Invoker");
Gateway.getORB().run();
}
}).start();
}
-
+
public void close() {
try {
mPOAManager.deactivate(true, true);
@@ -64,12 +65,12 @@ public class CorbaServer {
Logger.error(ex);
}
}
-
+
/**************************************************************************
* Initialises the C2KRootPOA with policies which are suitable for Factory objects
- **************************************************************************/
+ **************************************************************************/
public void setupPOA() throws Exception {
-
+
//Initialise the RootPOA
mRootPOA = org.omg.PortableServer.POAHelper.narrow(
Gateway.getORB().resolve_initial_references("RootPOA"));
@@ -78,8 +79,6 @@ public class CorbaServer {
mPOAManager = mRootPOA.the_POAManager();
- org.omg.CORBA.Policy[] poaPolicies;
-
// Create POA for use by the entities
org.omg.CORBA.Policy[] policies = new org.omg.CORBA.Policy[6];
@@ -103,32 +102,32 @@ public class CorbaServer {
policies );
mAgentPOA = mRootPOA.create_POA( "Agent",
mRootPOA.the_POAManager(),
- policies );
+ policies );
//Create the locators
TraceableLocator itemLocator = new TraceableLocator( mItemPOA );
- mItemPOA.set_servant_manager( itemLocator._this( Gateway.getORB() ) );
-
+ mItemPOA.set_servant_manager( itemLocator._this( Gateway.getORB() ) );
+
ActiveLocator agentLocator = new ActiveLocator( mAgentPOA );
mAgentPOA.set_servant_manager( agentLocator._this( Gateway.getORB() ) );
-
+
}
-
+
/**************************************************************************
* Returns a CORBA servant for a pre-existing entity
- **************************************************************************/
+ **************************************************************************/
private Servant getEntity(int sysKey, org.omg.PortableServer.POA poa) throws ObjectNotFoundException {
try {
EntityPath entityPath = new EntityPath(sysKey);
Servant entity = null;
synchronized (mEntityCache) {
- entity = (Servant)mEntityCache.get(entityPath);
+ entity = mEntityCache.get(entityPath);
if (entity == null) {
Logger.msg(7, "Creating new servant for "+sysKey);
-
- Class entityClass = Gateway.getLDAPLookup().getEntityClass(entityPath);
-
+
+ Class<?> entityClass = Gateway.getLDAPLookup().getEntityClass(entityPath);
+
if (entityClass == TraceableEntity.class) {
if (poa == null) poa = mItemPOA;
entity = new TraceableEntity(sysKey, poa);
@@ -141,12 +140,12 @@ public class CorbaServer {
}
}
return entity;
-
+
} catch (InvalidEntityPathException ex) {
throw new ObjectNotFoundException("Invalid Entity Key", "");
- }
+ }
}
-
+
/**************************************************************************
* Wrapper for fetching Items
**************************************************************************/
@@ -186,6 +185,6 @@ public class CorbaServer {
mEntityCache.put(entityPath, entity);
}
return entity;
-
+
}
}