You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by gn...@apache.org on 2007/03/29 23:21:36 UTC
svn commit: r523842 [1/2] - in
/incubator/servicemix/trunk/core/servicemix-core: ./
src/main/java/org/apache/servicemix/jbi/container/
src/main/java/org/apache/servicemix/jbi/framework/
src/main/java/org/apache/servicemix/jbi/framework/support/ src/mai...
Author: gnodet
Date: Thu Mar 29 14:21:34 2007
New Revision: 523842
URL: http://svn.apache.org/viewvc?view=rev&rev=523842
Log:
SM-903: use generics
Modified:
incubator/servicemix/trunk/core/servicemix-core/pom.xml
incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/container/SpringJBIContainer.java
incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/AutoDeploymentService.java
incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentRegistry.java
incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/EndpointRegistry.java
incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/InstallationContextImpl.java
incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/InstallationService.java
incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/Registry.java
incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ServiceAssemblyLifeCycle.java
incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ServiceAssemblyRegistry.java
incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/SubscriptionRegistry.java
incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/support/WSDL2Processor.java
incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/logging/LogService.java
incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/AttributeInfoHelper.java
incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/BaseStandardMBean.java
incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/ManagementContext.java
incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/OperationInfoHelper.java
incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/messaging/DeliveryChannelImpl.java
incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/monitoring/StatisticsService.java
incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/monitoring/stats/StatsImpl.java
incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/nmr/DefaultBroker.java
incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/nmr/SubscriptionManager.java
incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/nmr/flow/jca/JCAFlow.java
incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/nmr/flow/jms/AbstractJMSFlow.java
incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/nmr/flow/seda/SedaFlow.java
incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/security/SecuredBroker.java
incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/security/acl/AuthorizationMap.java
incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/security/acl/impl/AuthorizationEntry.java
incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/security/acl/impl/DefaultAuthorizationMap.java
incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/servicedesc/InternalEndpoint.java
incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/FastStack.java
incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/view/DotViewEndpointListener.java
incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/view/DotViewFlowListener.java
incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/messaging/DeliveryChannelImplTest.java
Modified: incubator/servicemix/trunk/core/servicemix-core/pom.xml
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/pom.xml?view=diff&rev=523842&r1=523841&r2=523842
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/pom.xml (original)
+++ incubator/servicemix/trunk/core/servicemix-core/pom.xml Thu Mar 29 14:21:34 2007
@@ -312,14 +312,6 @@
</testResources>
<plugins>
<plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>1.4</source>
- <target>1.4</target>
- </configuration>
- </plugin>
- <plugin>
<groupId>org.apache.xbean</groupId>
<artifactId>maven-xbean-plugin</artifactId>
<executions>
Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/container/SpringJBIContainer.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/container/SpringJBIContainer.java?view=diff&rev=523842&r1=523841&r2=523842
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/container/SpringJBIContainer.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/container/SpringJBIContainer.java Thu Mar 29 14:21:34 2007
@@ -182,7 +182,6 @@
private boolean isKnownEndpoint(Object endpoint, Class[] knownClasses) {
if (knownClasses != null) {
- boolean valid = false;
for (int i = 0; i < knownClasses.length; i++) {
if (knownClasses[i].isInstance(endpoint)) {
return true;
Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/AutoDeploymentService.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/AutoDeploymentService.java?view=diff&rev=523842&r1=523841&r2=523842
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/AutoDeploymentService.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/AutoDeploymentService.java Thu Mar 29 14:21:34 2007
@@ -24,7 +24,6 @@
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -72,10 +71,10 @@
private AtomicBoolean started = new AtomicBoolean(false);
private Timer statsTimer;
private TimerTask timerTask;
- private Map pendingComponents = new ConcurrentHashMap();
- private Map pendingSAs = new ConcurrentHashMap();
- private Map installFileMap = null;
- private Map deployFileMap = null;
+ private Map<File, ArchiveEntry> pendingComponents = new ConcurrentHashMap<File, ArchiveEntry>();
+ private Map<File, ArchiveEntry> pendingSAs = new ConcurrentHashMap<File, ArchiveEntry>();
+ private Map<String, ArchiveEntry> installFileMap = null;
+ private Map<String, ArchiveEntry> deployFileMap = null;
/**
* @return the extensions
@@ -183,7 +182,7 @@
initializeFileMaps();
}
- protected Class getServiceMBean() {
+ protected Class<AutoDeploymentServiceMBean> getServiceMBean() {
return AutoDeploymentServiceMBean.class;
}
@@ -261,8 +260,7 @@
}
String missings = null;
boolean canInstall = true;
- for (Iterator it = entry.dependencies.iterator(); it.hasNext();) {
- String libraryName = (String) it.next();
+ for (String libraryName : entry.dependencies) {
if (container.getRegistry().getSharedLibrary(libraryName) == null) {
canInstall = false;
if (missings != null) {
@@ -319,8 +317,7 @@
}
String missings = null;
boolean canDeploy = true;
- for (Iterator it = entry.dependencies.iterator(); it.hasNext();) {
- String componentName = (String) it.next();
+ for (String componentName : entry.dependencies) {
if (container.getComponent(componentName) == null) {
canDeploy = false;
if (missings != null) {
@@ -372,8 +369,8 @@
return new DeploymentException(ManagementSupport.createFrameworkMessage(msg, componentResults));
}
- protected Set getComponentNames(ServiceAssembly sa) {
- Set names = new HashSet();
+ protected Set<String> getComponentNames(ServiceAssembly sa) {
+ Set<String> names = new HashSet<String>();
if (sa.getServiceUnits() != null && sa.getServiceUnits().length > 0) {
for (int i = 0; i < sa.getServiceUnits().length; i++) {
names.add(sa.getServiceUnits()[i].getTarget().getComponentName());
@@ -382,8 +379,8 @@
return names;
}
- protected Set getSharedLibraryNames(Component comp) {
- Set names = new HashSet();
+ protected Set<String> getSharedLibraryNames(Component comp) {
+ Set<String> names = new HashSet<String>();
if (comp.getSharedLibraries() != null && comp.getSharedLibraries().length > 0) {
for (int i = 0; i < comp.getSharedLibraries().length; i++) {
names.add(comp.getSharedLibraries()[i].getName());
@@ -450,13 +447,11 @@
* installed.
*/
private void checkPendingSAs() {
- Set deployedSas = new HashSet();
- for (Iterator it = pendingSAs.entrySet().iterator(); it.hasNext();) {
- Map.Entry me = (Map.Entry) it.next();
- ArchiveEntry entry = (ArchiveEntry) me.getValue();
+ Set<File> deployedSas = new HashSet<File>();
+ for (Map.Entry<File, ArchiveEntry> me : pendingSAs.entrySet()) {
+ ArchiveEntry entry = me.getValue();
boolean canDeploy = true;
- for (Iterator it2 = entry.dependencies.iterator(); it2.hasNext();) {
- String componentName = (String) it2.next();
+ for (String componentName : entry.dependencies) {
if (container.getComponent(componentName) == null) {
canDeploy = false;
break;
@@ -477,8 +472,8 @@
}
if (!deployedSas.isEmpty()) {
// Remove SA from pending SAs
- for (Iterator it = deployedSas.iterator(); it.hasNext();) {
- ArchiveEntry entry = (ArchiveEntry) pendingSAs.remove(it.next());
+ for (File f : deployedSas) {
+ ArchiveEntry entry = pendingSAs.remove(f);
entry.pending = false;
}
// Store new state
@@ -488,20 +483,18 @@
}
private void checkPendingComponents() {
- Set installedComponents = new HashSet();
- for (Iterator it = pendingComponents.entrySet().iterator(); it.hasNext();) {
- Map.Entry me = (Map.Entry) it.next();
- ArchiveEntry entry = (ArchiveEntry) me.getValue();
+ Set<File> installedComponents = new HashSet<File>();
+ for (Map.Entry<File,ArchiveEntry> me : pendingComponents.entrySet()) {
+ ArchiveEntry entry = me.getValue();
boolean canInstall = true;
- for (Iterator it2 = entry.dependencies.iterator(); it2.hasNext();) {
- String libraryName = (String) it2.next();
+ for (String libraryName : entry.dependencies) {
if (container.getRegistry().getSharedLibrary(libraryName) == null) {
canInstall = false;
break;
}
}
if (canInstall) {
- File tmp = (File) me.getKey();
+ File tmp = me.getKey();
installedComponents.add(tmp);
try {
Descriptor root = DescriptorFactory.buildDescriptor(tmp);
@@ -514,8 +507,8 @@
}
if (!installedComponents.isEmpty()) {
// Remove SA from pending SAs
- for (Iterator it = installedComponents.iterator(); it.hasNext();) {
- ArchiveEntry entry = (ArchiveEntry) pendingComponents.remove(it.next());
+ for (File f : installedComponents) {
+ ArchiveEntry entry = pendingComponents.remove(f);
entry.pending = false;
}
// Store new state
@@ -615,7 +608,7 @@
}
- private void monitorDirectory(final File root, final Map fileMap) {
+ private void monitorDirectory(final File root, final Map<String, ArchiveEntry> fileMap) {
/*
if (log.isTraceEnabled()) {
if (root != null)
@@ -625,7 +618,7 @@
+ ((fileMap==installFileMap) ? "Installation" : "Deployment") + ".");
}
*/
- List tmpList=new ArrayList();
+ List<String> tmpList=new ArrayList<String>();
if(root!=null&&root.exists()&&root.isDirectory()){
File[] files=root.listFiles();
if(files!=null){
@@ -633,7 +626,7 @@
final File file=files[i];
tmpList.add(file.getName());
if (isAllowedExtension(file.getName())) {
- ArchiveEntry lastEntry = (ArchiveEntry) fileMap.get(file.getName());
+ ArchiveEntry lastEntry = fileMap.get(file.getName());
if(lastEntry == null || file.lastModified() > lastEntry.lastModified.getTime()){
try{
final ArchiveEntry entry = new ArchiveEntry();
@@ -656,11 +649,10 @@
}
}
// now remove any locations no longer here
- Map map=new HashMap(fileMap);
- for(Iterator i=map.keySet().iterator();i.hasNext();){
- String location=i.next().toString();
+ Map<String, ArchiveEntry> map=new HashMap<String, ArchiveEntry>(fileMap);
+ for(String location : map.keySet()) {
if(!tmpList.contains(location)){
- ArchiveEntry entry = (ArchiveEntry) fileMap.remove(location);
+ ArchiveEntry entry = fileMap.remove(location);
try{
log.info("Location "+location+" no longer exists - removing ...");
removeArchive(entry);
@@ -685,7 +677,7 @@
return false;
}
- private void persistState(File root, Map map) {
+ private void persistState(File root, Map<String, ArchiveEntry> map) {
try {
File file = new File(environmentContext.getJbiRootDir(), root.getName() + ".xml");
XmlPersistenceSupport.write(file, map);
@@ -694,12 +686,13 @@
}
}
- private Map readState(File root) {
- Map result = new HashMap();
+ @SuppressWarnings("unchecked")
+ private Map<String, ArchiveEntry> readState(File root) {
+ Map<String, ArchiveEntry> result = new HashMap<String, ArchiveEntry>();
try {
File file = new File(environmentContext.getJbiRootDir(), root.getName() + ".xml");
if (file.exists()) {
- result = (Map) XmlPersistenceSupport.read(file);
+ result = (Map<String, ArchiveEntry>) XmlPersistenceSupport.read(file);
} else {
log.debug("State file doesn't exist: " + file.getPath());
}
@@ -728,16 +721,15 @@
}
}
- private void removePendingEntries(Map map) {
- Set pendings = new HashSet();
- for (Iterator it = map.entrySet().iterator(); it.hasNext();) {
- Map.Entry e = (Map.Entry) it.next();
- if (((ArchiveEntry) e.getValue()).pending) {
+ private void removePendingEntries(Map<String, ArchiveEntry> map) {
+ Set<String> pendings = new HashSet<String>();
+ for (Map.Entry<String, ArchiveEntry> e : map.entrySet()) {
+ if (e.getValue().pending) {
pendings.add(e.getKey());
}
}
- for (Iterator it = pendings.iterator(); it.hasNext();) {
- map.remove(it.next());
+ for (String s : pendings) {
+ map.remove(s);
}
}
@@ -747,6 +739,6 @@
public String type;
public String name;
public boolean pending;
- public transient Set dependencies;
+ public transient Set<String> dependencies;
}
}
Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentRegistry.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentRegistry.java?view=diff&rev=523842&r1=523841&r2=523842
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentRegistry.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentRegistry.java Thu Mar 29 14:21:34 2007
@@ -33,7 +33,7 @@
*/
public class ComponentRegistry {
- private Map idMap = new LinkedHashMap();
+ private Map<ComponentNameSpace, ComponentMBeanImpl> idMap = new LinkedHashMap<ComponentNameSpace, ComponentMBeanImpl>();
private boolean runningStateInitialized = false;
private Registry registry;
@@ -72,8 +72,8 @@
*/
public synchronized void start() throws JBIException{
if (!setInitialRunningStateFromStart()) {
- for(Iterator i = getComponents().iterator(); i.hasNext();) {
- ComponentMBeanImpl lcc = (ComponentMBeanImpl) i.next();
+ for(Iterator<ComponentMBeanImpl> i = getComponents().iterator(); i.hasNext();) {
+ ComponentMBeanImpl lcc = i.next();
lcc.doStart();
}
}
@@ -86,8 +86,8 @@
* @throws JBIException
*/
public synchronized void stop() throws JBIException {
- for (Iterator i = getReverseComponents(). iterator();i.hasNext();) {
- ComponentMBeanImpl lcc = (ComponentMBeanImpl) i.next();
+ for (Iterator<ComponentMBeanImpl> i = getReverseComponents(). iterator();i.hasNext();) {
+ ComponentMBeanImpl lcc = i.next();
lcc.doStop();
}
runningStateInitialized = false;
@@ -99,16 +99,16 @@
* @throws JBIException
*/
public synchronized void shutDown() throws JBIException {
- for (Iterator i = getReverseComponents().iterator();i.hasNext();) {
- ComponentMBeanImpl lcc = (ComponentMBeanImpl) i.next();
+ for (Iterator<ComponentMBeanImpl> i = getReverseComponents().iterator();i.hasNext();) {
+ ComponentMBeanImpl lcc = i.next();
lcc.persistRunningState();
lcc.doShutDown();
}
}
- private Collection getReverseComponents() {
+ private Collection<ComponentMBeanImpl> getReverseComponents() {
synchronized (idMap) {
- ArrayList l = new ArrayList(idMap.values());
+ ArrayList<ComponentMBeanImpl> l = new ArrayList<ComponentMBeanImpl>(idMap.values());
Collections.reverse(l);
return l;
}
@@ -131,7 +131,7 @@
*/
public ComponentMBeanImpl getComponent(ComponentNameSpace id) {
synchronized (idMap) {
- return (ComponentMBeanImpl) idMap.get(id);
+ return idMap.get(id);
}
}
@@ -139,9 +139,9 @@
*
* @return Collection of ComponentConnectors held by the registry
*/
- public Collection getComponents() {
+ public Collection<ComponentMBeanImpl> getComponents() {
synchronized (idMap) {
- return new ArrayList(idMap.values());
+ return new ArrayList<ComponentMBeanImpl>(idMap.values());
}
}
@@ -149,8 +149,8 @@
boolean result = !runningStateInitialized;
if (!runningStateInitialized){
runningStateInitialized = true;
- for (Iterator i = getComponents().iterator();i.hasNext();) {
- ComponentMBeanImpl lcc = (ComponentMBeanImpl) i.next();
+ for (Iterator<ComponentMBeanImpl> i = getComponents().iterator();i.hasNext();) {
+ ComponentMBeanImpl lcc = i.next();
if(!lcc.isPojo() && !registry.isContainerEmbedded()){
lcc.setInitialRunningState();
}else {
Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/EndpointRegistry.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/EndpointRegistry.java?view=diff&rev=523842&r1=523841&r2=523842
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/EndpointRegistry.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/EndpointRegistry.java Thu Mar 29 14:21:34 2007
@@ -53,17 +53,17 @@
private Registry registry;
- private Map endpointMBeans;
+ private Map<AbstractServiceEndpoint, Endpoint> endpointMBeans;
- private Map internalEndpoints;
+ private Map<String, ServiceEndpoint> internalEndpoints;
- private Map externalEndpoints;
+ private Map<String, ServiceEndpoint> externalEndpoints;
- private Map linkedEndpoints;
+ private Map<String, ServiceEndpoint> linkedEndpoints;
- private Map interfaceConnections;
+ private Map<QName, InterfaceConnection> interfaceConnections;
- private List endpointProcessors;
+ private List<EndpointProcessor> endpointProcessors;
/**
* Constructor
@@ -72,16 +72,16 @@
*/
public EndpointRegistry(Registry registry) {
this.registry = registry;
- this.endpointMBeans = new ConcurrentHashMap();
- this.internalEndpoints = new ConcurrentHashMap();
- this.externalEndpoints = new ConcurrentHashMap();
- this.linkedEndpoints = new ConcurrentHashMap();
- this.interfaceConnections = new ConcurrentHashMap();
+ this.endpointMBeans = new ConcurrentHashMap<AbstractServiceEndpoint, Endpoint>();
+ this.internalEndpoints = new ConcurrentHashMap<String, ServiceEndpoint>();
+ this.externalEndpoints = new ConcurrentHashMap<String, ServiceEndpoint>();
+ this.linkedEndpoints = new ConcurrentHashMap<String, ServiceEndpoint>();
+ this.interfaceConnections = new ConcurrentHashMap<QName, InterfaceConnection>();
this.endpointProcessors = getEndpointProcessors();
}
- protected List getEndpointProcessors() {
- List l = new ArrayList();
+ protected List<EndpointProcessor> getEndpointProcessors() {
+ List<EndpointProcessor> l = new ArrayList<EndpointProcessor>();
String[] classes = { "org.apache.servicemix.jbi.framework.support.SUDescriptorProcessor",
"org.apache.servicemix.jbi.framework.support.WSDL1Processor",
"org.apache.servicemix.jbi.framework.support.WSDL2Processor" };
@@ -98,8 +98,8 @@
}
public ServiceEndpoint[] getEndpointsForComponent(ComponentNameSpace cns) {
- Collection endpoints = new ArrayList();
- for (Iterator iter = getInternalEndpoints().iterator(); iter.hasNext();) {
+ Collection<ServiceEndpoint> endpoints = new ArrayList<ServiceEndpoint>();
+ for (Iterator<ServiceEndpoint> iter = getInternalEndpoints().iterator(); iter.hasNext();) {
InternalEndpoint endpoint = (InternalEndpoint) iter.next();
if (cns.equals(endpoint.getComponentNameSpace())) {
endpoints.add(endpoint);
@@ -109,14 +109,14 @@
}
public ServiceEndpoint[] getAllEndpointsForComponent(ComponentNameSpace cns) {
- Collection endpoints = new ArrayList();
- for (Iterator iter = getInternalEndpoints().iterator(); iter.hasNext();) {
+ Collection<ServiceEndpoint> endpoints = new ArrayList<ServiceEndpoint>();
+ for (Iterator<ServiceEndpoint> iter = getInternalEndpoints().iterator(); iter.hasNext();) {
InternalEndpoint endpoint = (InternalEndpoint) iter.next();
if (cns.equals(endpoint.getComponentNameSpace())) {
endpoints.add(endpoint);
}
}
- for (Iterator iter = getExternalEndpoints().iterator(); iter.hasNext();) {
+ for (Iterator<ServiceEndpoint> iter = getExternalEndpoints().iterator(); iter.hasNext();) {
ExternalEndpoint endpoint = (ExternalEndpoint) iter.next();
if (cns.equals(endpoint.getComponentNameSpace())) {
endpoints.add(endpoint);
@@ -128,7 +128,7 @@
/**
* Returns a collection of Endpoint objects
*/
- public Collection getEndpointMBeans() {
+ public Collection<Endpoint> getEndpointMBeans() {
return endpointMBeans.values();
}
@@ -139,7 +139,7 @@
* @return array of endpoints
*/
public ServiceEndpoint[] getEndpointsForService(QName serviceName) {
- Collection collection = getEndpointsByService(serviceName, getInternalEndpoints());
+ Collection<ServiceEndpoint> collection = getEndpointsByService(serviceName, getInternalEndpoints());
return asEndpointArray(collection);
}
@@ -155,10 +155,10 @@
if (interfaceName == null) {
return asEndpointArray(internalEndpoints.values());
}
- InterfaceConnection conn = (InterfaceConnection) interfaceConnections.get(interfaceName);
+ InterfaceConnection conn = interfaceConnections.get(interfaceName);
if (conn != null) {
String key = getKey(conn.service, conn.endpoint);
- ServiceEndpoint ep = (ServiceEndpoint) internalEndpoints.get(key);
+ ServiceEndpoint ep = internalEndpoints.get(key);
if (ep == null) {
logger.warn("Connection for interface " + interfaceName + " could not find target for service " + conn.service + " and endpoint " + conn.endpoint);
return new ServiceEndpoint[0];
@@ -166,7 +166,7 @@
return new ServiceEndpoint[] { ep };
}
}
- Collection result = getEndpointsByInterface(interfaceName, getInternalEndpoints());
+ Collection<ServiceEndpoint> result = getEndpointsByInterface(interfaceName, getInternalEndpoints());
return asEndpointArray(result);
}
@@ -194,8 +194,8 @@
serviceEndpoint.addInterface(provider.getActivationSpec().getInterfaceName());
}
// Get interfaces
- for (Iterator it = endpointProcessors.iterator(); it.hasNext();) {
- EndpointProcessor p = (EndpointProcessor) it.next();
+ for (Iterator<EndpointProcessor> it = endpointProcessors.iterator(); it.hasNext();) {
+ EndpointProcessor p = it.next();
p.process(serviceEndpoint);
}
// Set remote namespaces
@@ -275,15 +275,15 @@
*/
public ServiceEndpoint getEndpoint(QName service, String name) {
String key = getKey(service, name);
- ServiceEndpoint ep = (ServiceEndpoint) linkedEndpoints.get(key);
+ ServiceEndpoint ep = linkedEndpoints.get(key);
if (ep == null) {
- ep = (ServiceEndpoint) internalEndpoints.get(key);
+ ep = internalEndpoints.get(key);
}
return ep;
}
public ServiceEndpoint getInternalEndpoint(QName service, String name) {
- return (ServiceEndpoint) internalEndpoints.get(getKey(service, name));
+ return internalEndpoints.get(getKey(service, name));
}
/**
@@ -327,7 +327,7 @@
* empty.
*/
public ServiceEndpoint[] getExternalEndpointsForInterface(QName interfaceName) {
- Collection endpoints = getEndpointsByInterface(interfaceName, getExternalEndpoints());
+ Collection<ServiceEndpoint> endpoints = getEndpointsByInterface(interfaceName, getExternalEndpoints());
return asEndpointArray(endpoints);
}
@@ -338,7 +338,7 @@
* @return an array of available external endpoints for the specified service name; must be non-null; may be empty.
*/
public ServiceEndpoint[] getExternalEndpointsForService(QName serviceName) {
- Collection endpoints = getEndpointsByService(serviceName, getExternalEndpoints());
+ Collection<ServiceEndpoint> endpoints = getEndpointsByService(serviceName, getExternalEndpoints());
return asEndpointArray(endpoints);
}
@@ -348,12 +348,12 @@
* @param collection
* @return array of endpoints
*/
- protected ServiceEndpoint[] asEndpointArray(Collection collection) {
+ protected ServiceEndpoint[] asEndpointArray(Collection<ServiceEndpoint> collection) {
if (collection == null) {
return new ServiceEndpoint[0];
}
ServiceEndpoint[] answer = new ServiceEndpoint[collection.size()];
- answer = (ServiceEndpoint[]) collection.toArray(answer);
+ answer = collection.toArray(answer);
return answer;
}
@@ -364,10 +364,10 @@
* @param endpoints
* @return collection of endpoints
*/
- protected Collection getEndpointsByService(QName serviceName, Collection endpoints) {
- Collection answer = new ArrayList();
- for (Iterator i = endpoints.iterator(); i.hasNext();) {
- ServiceEndpoint endpoint = (ServiceEndpoint) i.next();
+ protected Collection<ServiceEndpoint> getEndpointsByService(QName serviceName, Collection<ServiceEndpoint> endpoints) {
+ Collection<ServiceEndpoint> answer = new ArrayList<ServiceEndpoint>();
+ for (Iterator<ServiceEndpoint> i = endpoints.iterator(); i.hasNext();) {
+ ServiceEndpoint endpoint = i.next();
if (endpoint.getServiceName().equals(serviceName)) {
answer.add(endpoint);
}
@@ -381,13 +381,13 @@
* is applied.
*
*/
- protected Collection getEndpointsByInterface(QName interfaceName, Collection endpoints) {
+ protected Collection<ServiceEndpoint> getEndpointsByInterface(QName interfaceName, Collection<ServiceEndpoint> endpoints) {
if (interfaceName == null) {
return endpoints;
}
- Set answer = new HashSet();
- for (Iterator i = endpoints.iterator(); i.hasNext();) {
- ServiceEndpoint endpoint = (ServiceEndpoint) i.next();
+ Set<ServiceEndpoint> answer = new HashSet<ServiceEndpoint>();
+ for (Iterator<ServiceEndpoint> i = endpoints.iterator(); i.hasNext();) {
+ ServiceEndpoint endpoint = i.next();
QName[] interfaces = endpoint.getInterfaces();
if (interfaces != null) {
for (int k = 0; k < interfaces.length;k ++) {
@@ -405,14 +405,14 @@
/**
* @return all default endpoints
*/
- protected Collection getInternalEndpoints() {
+ protected Collection<ServiceEndpoint> getInternalEndpoints() {
return internalEndpoints.values();
}
/**
* @return all external endpoints
*/
- protected Collection getExternalEndpoints() {
+ protected Collection<ServiceEndpoint> getExternalEndpoints() {
return externalEndpoints.values();
}
@@ -485,7 +485,7 @@
}
private void unregisterEndpoint(AbstractServiceEndpoint se) {
- Endpoint ep = (Endpoint) endpointMBeans.remove(se);
+ Endpoint ep = endpointMBeans.remove(se);
try {
registry.getContainer().getManagementContext().unregisterMBean(ep);
} catch (JBIException e) {
Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/InstallationContextImpl.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/InstallationContextImpl.java?view=diff&rev=523842&r1=523841&r2=523842
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/InstallationContextImpl.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/InstallationContextImpl.java Thu Mar 29 14:21:34 2007
@@ -42,7 +42,7 @@
private Component descriptor;
private File installRoot;
- private List classPathElements = Collections.EMPTY_LIST;
+ private List<String> classPathElements = Collections.emptyList();
private ComponentContext context;
private boolean install = true;
@@ -191,7 +191,7 @@
* @exception IllegalArgumentException if the class path elements is null, empty, or if an individual element is
* ill-formed.
*/
- public void setClassPathElements(java.util.List classPathElements) {
+ public void setClassPathElements(List classPathElements) {
if (classPathElements == null) {
throw new IllegalArgumentException("classPathElements is null");
}
@@ -214,7 +214,7 @@
throw new IllegalArgumentException("classPathElements should not contain absolute paths");
}
}
- this.classPathElements = new ArrayList(classPathElements);
+ this.classPathElements = new ArrayList<String>(classPathElements);
}
Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/InstallationService.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/InstallationService.java?view=diff&rev=523842&r1=523841&r2=523842
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/InstallationService.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/InstallationService.java Thu Mar 29 14:21:34 2007
@@ -61,8 +61,8 @@
private EnvironmentContext environmentContext;
private ManagementContext managementContext;
- private Map installers=new ConcurrentHashMap();
- private Map nonLoadedInstallers = new ConcurrentHashMap();
+ private Map<String, InstallerMBeanImpl> installers = new ConcurrentHashMap<String, InstallerMBeanImpl>();
+ private Map<String, InstallerMBeanImpl> nonLoadedInstallers = new ConcurrentHashMap<String, InstallerMBeanImpl>();
/**
* Get Description
@@ -90,12 +90,12 @@
if(tmpDir!=null){
Descriptor root=DescriptorFactory.buildDescriptor(tmpDir);
if(root!=null&&root.getComponent()!=null){
- String componentName=root.getComponent().getIdentification().getName();
+ String componentName = root.getComponent().getIdentification().getName();
if(!installers.containsKey(componentName)){
- InstallerMBeanImpl installer=doInstallArchive(tmpDir,root);
+ InstallerMBeanImpl installer = doInstallArchive(tmpDir,root);
if(installer!=null){
result=installer.getObjectName();
- installers.put(componentName,installer);
+ installers.put(componentName, installer);
}
}else{
throw new RuntimeException("An installer already exists for "+componentName);
@@ -128,9 +128,9 @@
* @return - the JMX ObjectName of the InstallerMBean loaded from an existing installation context.
*/
public ObjectName loadInstaller(String aComponentName) {
- InstallerMBeanImpl installer = (InstallerMBeanImpl) installers.get(aComponentName);
+ InstallerMBeanImpl installer = installers.get(aComponentName);
if (installer == null) {
- installer = (InstallerMBeanImpl) nonLoadedInstallers.get(aComponentName);
+ installer = nonLoadedInstallers.get(aComponentName);
if (installer != null) {
try {
// create an MBean for the installer
@@ -178,7 +178,7 @@
boolean result = false;
try {
container.getBroker().suspend();
- InstallerMBeanImpl installer = (InstallerMBeanImpl) installers.remove(componentName);
+ InstallerMBeanImpl installer = installers.remove(componentName);
result = installer != null;
if(result) {
container.getManagementContext().unregisterMBean(installer);
Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/Registry.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/Registry.java?view=diff&rev=523842&r1=523841&r2=523842
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/Registry.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/Registry.java Thu Mar 29 14:21:34 2007
@@ -19,7 +19,6 @@
import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -73,10 +72,10 @@
private EndpointRegistry endpointRegistry;
private SubscriptionRegistry subscriptionRegistry;
private ServiceAssemblyRegistry serviceAssemblyRegistry;
- private Map sharedLibraries;
- private Map serviceUnits;
- private List pendingAssemblies;
- private List pendingComponents;
+ private Map<String, SharedLibrary> sharedLibraries;
+ private Map<String, ServiceUnitLifeCycle> serviceUnits;
+ private List<ServiceAssemblyLifeCycle> pendingAssemblies;
+ private List<ComponentMBeanImpl> pendingComponents;
private Executor executor;
/**
@@ -87,10 +86,10 @@
this.endpointRegistry = new EndpointRegistry(this);
this.subscriptionRegistry = new SubscriptionRegistry(this);
this.serviceAssemblyRegistry = new ServiceAssemblyRegistry(this);
- this.serviceUnits = new ConcurrentHashMap();
- this.pendingAssemblies = new CopyOnWriteArrayList();
- this.sharedLibraries = new ConcurrentHashMap();
- this.pendingComponents = new CopyOnWriteArrayList();
+ this.serviceUnits = new ConcurrentHashMap<String, ServiceUnitLifeCycle>();
+ this.pendingAssemblies = new CopyOnWriteArrayList<ServiceAssemblyLifeCycle>();
+ this.sharedLibraries = new ConcurrentHashMap<String, SharedLibrary>();
+ this.pendingComponents = new CopyOnWriteArrayList<ComponentMBeanImpl>();
}
/**
@@ -247,9 +246,7 @@
* cannot be resolved.
*/
public ServiceEndpoint resolveEndpointReference(DocumentFragment epr) {
- Collection connectors = getComponents();
- for (Iterator iter = connectors.iterator(); iter.hasNext();) {
- ComponentMBeanImpl connector = (ComponentMBeanImpl) iter.next();
+ for (ComponentMBeanImpl connector : getComponents()) {
ServiceEndpoint se = connector.getComponent().resolveEndpointReference(epr);
if (se != null) {
return new DynamicEndpoint(connector.getComponentNameSpace(), se, epr);
@@ -481,7 +478,7 @@
/**
* @return all local ComponentConnectors
*/
- public Collection getComponents() {
+ public Collection<ComponentMBeanImpl> getComponents() {
return componentRegistry.getComponents();
}
@@ -510,9 +507,8 @@
*/
public ObjectName[] getEngineComponents() {
ObjectName[] result = null;
- List tmpList = new ArrayList();
- for (Iterator i = getComponents().iterator(); i.hasNext();){
- ComponentMBeanImpl lcc = (ComponentMBeanImpl) i.next();
+ List<ObjectName> tmpList = new ArrayList<ObjectName>();
+ for (ComponentMBeanImpl lcc : getComponents()) {
if (!lcc.isPojo() && lcc.isService() && lcc.getMBeanName() != null){
tmpList.add(lcc.getMBeanName());
}
@@ -529,9 +525,8 @@
*/
public ObjectName[] getBindingComponents() {
ObjectName[] result = null;
- List tmpList = new ArrayList();
- for (Iterator i = getComponents().iterator(); i.hasNext();){
- ComponentMBeanImpl lcc = (ComponentMBeanImpl) i.next();
+ List<ObjectName> tmpList = new ArrayList<ObjectName>();
+ for (ComponentMBeanImpl lcc : getComponents()) {
if (!lcc.isPojo() && lcc.isBinding() && lcc.getMBeanName() != null){
tmpList.add(lcc.getMBeanName());
}
@@ -547,9 +542,8 @@
*/
public ObjectName[] getPojoComponents() {
ObjectName[] result = null;
- List tmpList = new ArrayList();
- for (Iterator i = getComponents().iterator(); i.hasNext();){
- ComponentMBeanImpl lcc = (ComponentMBeanImpl) i.next();
+ List<ObjectName> tmpList = new ArrayList<ObjectName>();
+ for (ComponentMBeanImpl lcc : getComponents()) {
if (lcc.isPojo() && lcc.getMBeanName() != null){
tmpList.add(lcc.getMBeanName());
}
@@ -617,7 +611,7 @@
* @param exchange
* @return a List of matching endpoints - can return null if no matches
*/
- public List getMatchingSubscriptionEndpoints(MessageExchangeImpl exchange) {
+ public List<InternalEndpoint> getMatchingSubscriptionEndpoints(MessageExchangeImpl exchange) {
return subscriptionRegistry.getMatchingSubscriptionEndpoints(exchange);
}
@@ -669,10 +663,8 @@
* @return List of deployed service units
*/
public ServiceUnitLifeCycle[] getDeployedServiceUnits(String componentName) {
- Collection sus = serviceUnits.values();
- List tmpList = new ArrayList();
- for (Iterator iter = sus.iterator(); iter.hasNext();) {
- ServiceUnitLifeCycle su = (ServiceUnitLifeCycle) iter.next();
+ List<ServiceUnitLifeCycle> tmpList = new ArrayList<ServiceUnitLifeCycle>();
+ for (ServiceUnitLifeCycle su : serviceUnits.values()) {
if (su.getComponentName().equals(componentName)) {
tmpList.add(su);
}
@@ -687,11 +679,11 @@
*
* @return list of all service units
*/
- public Collection getServiceUnits() {
+ public Collection<ServiceUnitLifeCycle> getServiceUnits() {
return serviceUnits.values();
}
- public Collection getServiceAssemblies() {
+ public Collection<ServiceAssemblyLifeCycle> getServiceAssemblies() {
return serviceAssemblyRegistry.getServiceAssemblies();
}
@@ -742,7 +734,7 @@
* @return the ServiceUnit or null of it doesn't exist
*/
public ServiceUnitLifeCycle getServiceUnit(String suKey) {
- return (ServiceUnitLifeCycle) serviceUnits.get(suKey);
+ return serviceUnits.get(suKey);
}
/**
@@ -774,7 +766,7 @@
* @param suKey the key of the service unit
*/
public void unregisterServiceUnit(String suKey) {
- ServiceUnitLifeCycle sulc = (ServiceUnitLifeCycle) this.serviceUnits.remove(suKey);
+ ServiceUnitLifeCycle sulc = this.serviceUnits.remove(suKey);
if (sulc != null) {
try {
getContainer().getManagementContext().unregisterMBean(sulc);
@@ -800,7 +792,7 @@
public void unregisterSharedLibrary(String name) {
// TODO: check for components depending on this library,
// shutdown them and add them to the list of pending components
- SharedLibrary sl = (SharedLibrary) this.sharedLibraries.remove(name);
+ SharedLibrary sl = this.sharedLibraries.remove(name);
if (sl != null) {
try {
getContainer().getManagementContext().unregisterMBean(sl);
@@ -812,10 +804,10 @@
}
public SharedLibrary getSharedLibrary(String name) {
- return (SharedLibrary) sharedLibraries.get(name);
+ return sharedLibraries.get(name);
}
- public Collection getSharedLibraries() {
+ public Collection<SharedLibrary> getSharedLibraries() {
return sharedLibraries.values();
}
@@ -858,8 +850,7 @@
}
protected synchronized void startPendingAssemblies() {
- for (Iterator iter = pendingAssemblies.iterator(); iter.hasNext();) {
- ServiceAssemblyLifeCycle sa = (ServiceAssemblyLifeCycle) iter.next();
+ for (ServiceAssemblyLifeCycle sa : pendingAssemblies) {
ServiceUnitLifeCycle[] sus = sa.getDeployedSUs();
boolean ok = true;
for (int i = 0; i < sus.length; i++) {
@@ -895,55 +886,49 @@
}
protected synchronized void startPendingComponents() {
- for (Iterator iter = pendingComponents.iterator(); iter.hasNext();) {
- ComponentMBeanImpl comp = (ComponentMBeanImpl) iter.next();
+ for (ComponentMBeanImpl lcc : pendingComponents) {
// TODO: restore component state if
}
}
public ObjectName[] getComponentNames() {
- List tmpList = new ArrayList();
- for (Iterator i = getComponents().iterator(); i.hasNext();){
- ComponentMBeanImpl lcc = (ComponentMBeanImpl) i.next();
+ List<ObjectName> tmpList = new ArrayList<ObjectName>();
+ for (ComponentMBeanImpl lcc : getComponents()) {
tmpList.add(container.getManagementContext().createObjectName(lcc));
}
- return (ObjectName[]) tmpList.toArray(new ObjectName[tmpList.size()]);
+ return tmpList.toArray(new ObjectName[tmpList.size()]);
}
public ObjectName[] getEndpointNames() {
- List tmpList = new ArrayList();
- for (Iterator i = container.getRegistry().getEndpointRegistry().getEndpointMBeans().iterator(); i.hasNext();){
- Endpoint ep = (Endpoint) i.next();
+ List<ObjectName> tmpList = new ArrayList<ObjectName>();
+ for (Endpoint ep : container.getRegistry().getEndpointRegistry().getEndpointMBeans()){
tmpList.add(container.getManagementContext().createObjectName(ep));
}
- return (ObjectName[]) tmpList.toArray(new ObjectName[tmpList.size()]);
+ return tmpList.toArray(new ObjectName[tmpList.size()]);
}
public ObjectName[] getServiceAssemblyNames() {
- List tmpList = new ArrayList();
- for (Iterator i = getServiceAssemblies().iterator(); i.hasNext();){
- ServiceAssemblyLifeCycle sa = (ServiceAssemblyLifeCycle) i.next();
+ List<ObjectName> tmpList = new ArrayList<ObjectName>();
+ for (ServiceAssemblyLifeCycle sa : getServiceAssemblies()){
tmpList.add(container.getManagementContext().createObjectName(sa));
}
- return (ObjectName[]) tmpList.toArray(new ObjectName[tmpList.size()]);
+ return tmpList.toArray(new ObjectName[tmpList.size()]);
}
public ObjectName[] getServiceUnitNames() {
- List tmpList = new ArrayList();
- for (Iterator i = serviceUnits.values().iterator(); i.hasNext();){
- ServiceUnitLifeCycle su = (ServiceUnitLifeCycle) i.next();
+ List<ObjectName> tmpList = new ArrayList<ObjectName>();
+ for (ServiceUnitLifeCycle su : serviceUnits.values()) {
tmpList.add(container.getManagementContext().createObjectName(su));
}
- return (ObjectName[]) tmpList.toArray(new ObjectName[tmpList.size()]);
+ return tmpList.toArray(new ObjectName[tmpList.size()]);
}
public ObjectName[] getSharedLibraryNames() {
- List tmpList = new ArrayList();
- for (Iterator i = sharedLibraries.values().iterator(); i.hasNext();){
- SharedLibrary sl = (SharedLibrary) i.next();
+ List<ObjectName> tmpList = new ArrayList<ObjectName>();
+ for (SharedLibrary sl : sharedLibraries.values()) {
tmpList.add(container.getManagementContext().createObjectName(sl));
}
- return (ObjectName[]) tmpList.toArray(new ObjectName[tmpList.size()]);
+ return tmpList.toArray(new ObjectName[tmpList.size()]);
}
/**
Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ServiceAssemblyLifeCycle.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ServiceAssemblyLifeCycle.java?view=diff&rev=523842&r1=523841&r2=523842
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ServiceAssemblyLifeCycle.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ServiceAssemblyLifeCycle.java Thu Mar 29 14:21:34 2007
@@ -114,7 +114,7 @@
throw ManagementSupport.failure("start", e.getMessage());
}
// Start service units
- List componentFailures = new ArrayList();
+ List<Element> componentFailures = new ArrayList<Element>();
for (int i = 0; i < sus.length; i++) {
if (sus[i].isShutDown()) {
try {
@@ -160,7 +160,7 @@
// Stop connections
stopConnections();
// Stop service units
- List componentFailures = new ArrayList();
+ List<Element> componentFailures = new ArrayList<Element>();
if (forceInit) {
for (int i = 0; i < sus.length; i++) {
try {
@@ -203,7 +203,7 @@
public synchronized String shutDown(boolean writeState) throws Exception {
log.info("Shutting down service assembly: " + getName());
- List componentFailures = new ArrayList();
+ List<Element> componentFailures = new ArrayList<Element>();
for (int i = 0; i < sus.length; i++) {
if (sus[i].isStarted()) {
try {
Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ServiceAssemblyRegistry.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ServiceAssemblyRegistry.java?view=diff&rev=523842&r1=523841&r2=523842
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ServiceAssemblyRegistry.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ServiceAssemblyRegistry.java Thu Mar 29 14:21:34 2007
@@ -19,7 +19,6 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -44,7 +43,7 @@
public class ServiceAssemblyRegistry {
private static final Log log = LogFactory.getLog(ServiceAssemblyRegistry.class);
- private Map serviceAssemblies = new ConcurrentHashMap();
+ private Map<String, ServiceAssemblyLifeCycle> serviceAssemblies = new ConcurrentHashMap<String, ServiceAssemblyLifeCycle>();
private Registry registry;
/**
@@ -79,7 +78,7 @@
String saName = sa.getIdentification().getName();
if (!serviceAssemblies.containsKey(saName)) {
ServiceAssemblyLifeCycle salc = new ServiceAssemblyLifeCycle(sa, env, registry);
- List sus = new ArrayList();
+ List<ServiceUnitLifeCycle> sus = new ArrayList<ServiceUnitLifeCycle>();
for (int i = 0; i < suKeys.length; i++) {
sus.add(registry.getServiceUnit(suKeys[i]));
}
@@ -97,7 +96,7 @@
}
public ServiceAssemblyLifeCycle register(ServiceAssembly sa, ServiceAssemblyEnvironment env) throws DeploymentException {
- List sus = new ArrayList();
+ List<String> sus = new ArrayList<String>();
if (sa.getServiceUnits() != null) {
for (int i = 0; i < sa.getServiceUnits().length; i++) {
String suKey = registry.registerServiceUnit(
@@ -109,7 +108,7 @@
}
}
return register(sa,
- (String[]) sus.toArray(new String[sus.size()]),
+ sus.toArray(new String[sus.size()]),
env);
}
@@ -119,7 +118,7 @@
* @return true if successful
*/
public boolean unregister(String name) {
- ServiceAssemblyLifeCycle salc = (ServiceAssemblyLifeCycle) serviceAssemblies.remove(name);
+ ServiceAssemblyLifeCycle salc = serviceAssemblies.remove(name);
if (salc != null) {
try {
ServiceUnitLifeCycle[] sus = salc.getDeployedSUs();
@@ -144,7 +143,7 @@
* @return the ServiceAssembly or null if it doesn't exist
*/
public ServiceAssemblyLifeCycle getServiceAssembly(String saName) {
- return (ServiceAssemblyLifeCycle) serviceAssemblies.get(saName);
+ return serviceAssemblies.get(saName);
}
/**
@@ -154,7 +153,7 @@
*/
public String[] getDeployedServiceAssemblies() {
String[] result = null;
- Set keys = serviceAssemblies.keySet();
+ Set<String> keys = serviceAssemblies.keySet();
result = new String[keys.size()];
keys.toArray(result);
return result;
@@ -169,9 +168,8 @@
public String[] getDeployedServiceAssembliesForComponent(String componentName) {
String[] result = null;
// iterate through the service assembilies
- Set tmpList = new HashSet();
- for (Iterator iter = serviceAssemblies.values().iterator();iter.hasNext();) {
- ServiceAssemblyLifeCycle salc = (ServiceAssemblyLifeCycle) iter.next();
+ Set<String> tmpList = new HashSet<String>();
+ for (ServiceAssemblyLifeCycle salc : serviceAssemblies.values()) {
ServiceUnit[] sus = salc.getServiceAssembly().getServiceUnits();
if (sus != null) {
for (int i = 0;i < sus.length;i++) {
@@ -194,7 +192,7 @@
*/
public String[] getComponentsForDeployedServiceAssembly(String saName) {
String[] result = null;
- Set tmpList = new HashSet();
+ Set<String> tmpList = new HashSet<String>();
ServiceAssemblyLifeCycle sa = getServiceAssembly(saName);
if (sa != null) {
ServiceUnit[] sus = sa.getServiceAssembly().getServiceUnits();
@@ -218,8 +216,7 @@
*/
public boolean isDeployedServiceUnit(String componentName, String suName) {
boolean result = false;
- for (Iterator iter = serviceAssemblies.values().iterator();iter.hasNext();) {
- ServiceAssemblyLifeCycle salc = (ServiceAssemblyLifeCycle) iter.next();
+ for (ServiceAssemblyLifeCycle salc : serviceAssemblies.values()) {
ServiceUnit[] sus = salc.getServiceAssembly().getServiceUnits();
if (sus != null) {
for (int i = 0;i < sus.length;i++) {
@@ -239,7 +236,7 @@
*
* @return list of service assemblies
*/
- public Collection getServiceAssemblies() {
+ public Collection<ServiceAssemblyLifeCycle> getServiceAssemblies() {
return serviceAssemblies.values();
}
Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/SubscriptionRegistry.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/SubscriptionRegistry.java?view=diff&rev=523842&r1=523841&r2=523842
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/SubscriptionRegistry.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/SubscriptionRegistry.java Thu Mar 29 14:21:34 2007
@@ -35,7 +35,7 @@
*/
public class SubscriptionRegistry {
- private Map subscriptions = new ConcurrentHashMap();
+ private Map<SubscriptionSpec, InternalEndpoint> subscriptions = new ConcurrentHashMap<SubscriptionSpec, InternalEndpoint>();
private Registry registry;
public SubscriptionRegistry(Registry registry) {
@@ -63,15 +63,15 @@
* @param exchange
* @return a List of matching endpoints - can return null if no matches
*/
- public List getMatchingSubscriptionEndpoints(MessageExchangeImpl exchange) {
- List result = null;
+ public List<InternalEndpoint> getMatchingSubscriptionEndpoints(MessageExchangeImpl exchange) {
+ List<InternalEndpoint> result = null;
for (Iterator iter = subscriptions.entrySet().iterator(); iter.hasNext();) {
Map.Entry entry = (Map.Entry) iter.next();
SubscriptionSpec subscription = (SubscriptionSpec) entry.getKey();
if (subscription.matches(registry,exchange)) {
if (result == null) {
- result = new ArrayList();
+ result = new ArrayList<InternalEndpoint>();
}
InternalEndpoint endpoint = (InternalEndpoint) entry.getValue();
result.add(endpoint);
Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/support/WSDL2Processor.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/support/WSDL2Processor.java?view=diff&rev=523842&r1=523841&r2=523842
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/support/WSDL2Processor.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/support/WSDL2Processor.java Thu Mar 29 14:21:34 2007
@@ -42,7 +42,6 @@
public static final String WSDL2_NAMESPACE = "http://www.w3.org/2006/01/wsdl";
-
private static final Log logger = LogFactory.getLog(WSDL2Processor.class);
private Registry registry;
Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/logging/LogService.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/logging/LogService.java?view=diff&rev=523842&r1=523841&r2=523842
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/logging/LogService.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/logging/LogService.java Thu Mar 29 14:21:34 2007
@@ -29,7 +29,6 @@
import javax.management.MBeanAttributeInfo;
import java.util.Timer;
import java.net.URL;
-import java.net.MalformedURLException;
/**
*
Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/AttributeInfoHelper.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/AttributeInfoHelper.java?view=diff&rev=523842&r1=523841&r2=523842
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/AttributeInfoHelper.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/AttributeInfoHelper.java Thu Mar 29 14:21:34 2007
@@ -34,7 +34,7 @@
*/
public class AttributeInfoHelper {
private PropertyUtilsBean beanUtil = new PropertyUtilsBean();
- private List list = new ArrayList();
+ private List<MBeanAttributeInfo> list = new ArrayList<MBeanAttributeInfo>();
/**
* Add an attribute
Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/BaseStandardMBean.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/BaseStandardMBean.java?view=diff&rev=523842&r1=523841&r2=523842
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/BaseStandardMBean.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/BaseStandardMBean.java Thu Mar 29 14:21:34 2007
@@ -72,7 +72,7 @@
MBeanRegistration,
PropertyChangeListener {
private final static Log log = LogFactory.getLog(BaseStandardMBean.class);
- private Map cachedAttributes = new LinkedHashMap();// used to maintain insertion ordering
+ private Map<String, CachedAttribute> cachedAttributes = new LinkedHashMap<String, CachedAttribute>();// used to maintain insertion ordering
private PropertyUtilsBean beanUtil = new PropertyUtilsBean();
private NotificationBroadcasterSupport broadcasterSupport = new NotificationBroadcasterSupport();
protected ExecutorService executorService;
@@ -139,15 +139,14 @@
*/
public Object getAttribute(String name) throws AttributeNotFoundException, MBeanException, ReflectionException {
Object result = null;
- CachedAttribute ca = (CachedAttribute) cachedAttributes.get(name);
+ CachedAttribute ca = cachedAttributes.get(name);
if (ca == null) {
// the use of proxies in MX4J has a bug - in which the caps can be changed on
// an attribute
- for (Iterator i = cachedAttributes.entrySet().iterator();i.hasNext();) {
- Map.Entry entry = (Map.Entry) i.next();
- String key = entry.getKey().toString();
+ for (Map.Entry<String, CachedAttribute> entry : cachedAttributes.entrySet()) {
+ String key = entry.getKey();
if (key.equalsIgnoreCase(name)) {
- ca = (CachedAttribute) entry.getValue();
+ ca = entry.getValue();
break;
}
}
@@ -173,7 +172,7 @@
public void setAttribute(Attribute attr) throws AttributeNotFoundException, InvalidAttributeValueException,
MBeanException, ReflectionException {
String name = attr.getName();
- CachedAttribute ca = (CachedAttribute) cachedAttributes.get(name);
+ CachedAttribute ca = cachedAttributes.get(name);
if (ca != null) {
Attribute old = ca.getAttribute();
try {
@@ -206,7 +205,7 @@
* @param value
*/
public void updateAttribute(String name, Object value) {
- CachedAttribute ca = (CachedAttribute) cachedAttributes.get(name);
+ CachedAttribute ca = cachedAttributes.get(name);
if (ca != null) {
Attribute old = ca.getAttribute();
ca.updateAttributeValue(value);
@@ -241,7 +240,7 @@
if (attributes != null) {
result = new AttributeList();
for (int i = 0;i < attributes.length;i++) {
- CachedAttribute ca = (CachedAttribute) cachedAttributes.get(attributes[i]);
+ CachedAttribute ca = cachedAttributes.get(attributes[i]);
ca.updateValue(beanUtil);
result.add(ca.getAttribute());
}
@@ -309,7 +308,7 @@
try {
Class[] parameterTypes = new Class[signature.length];
for (int i = 0; i < parameterTypes.length; i++) {
- parameterTypes[i] = (Class) primitiveClasses.get(signature[i]);
+ parameterTypes[i] = primitiveClasses.get(signature[i]);
if (parameterTypes[i] == null) {
parameterTypes[i] = Class.forName(signature[i]);
}
@@ -338,7 +337,7 @@
}
}
- private final static Hashtable primitiveClasses = new Hashtable(8);
+ private final static Hashtable<String, Class> primitiveClasses = new Hashtable<String, Class>(8);
{
primitiveClasses.put(Boolean.TYPE.toString(), Boolean.TYPE);
primitiveClasses.put(Character.TYPE.toString(), Character.TYPE);
Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/ManagementContext.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/ManagementContext.java?view=diff&rev=523842&r1=523841&r2=523842
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/ManagementContext.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/ManagementContext.java Thu Mar 29 14:21:34 2007
@@ -50,8 +50,8 @@
public static final String DEFAULT_CONNECTOR_PATH = "/jmxrmi";
public static final int DEFAULT_CONNECTOR_PORT = 1099;
private final static Log log = LogFactory.getLog(ManagementContext.class);
- private Map beanMap = new ConcurrentHashMap();
- protected Map systemServices = new ConcurrentHashMap();
+ private Map<ObjectName, Object> beanMap = new ConcurrentHashMap<ObjectName, Object>();
+ protected Map<String, ObjectName> systemServices = new ConcurrentHashMap<String, ObjectName>();
private MBeanServerContext mbeanServerContext = new MBeanServerContext();
private ExecutorService executors;
@@ -158,7 +158,7 @@
super.init(container);
}
- protected Class getServiceMBean() {
+ protected Class<ManagementContextMBean> getServiceMBean() {
return ManagementContextMBean.class;
}
@@ -188,10 +188,10 @@
public void shutDown() throws JBIException {
super.shutDown();
// Unregister all mbeans
- Object[] beans = beanMap.keySet().toArray();
+ ObjectName[] beans = beanMap.keySet().toArray(new ObjectName[beanMap.size()]);
for (int i = 0; i < beans.length; i++) {
try {
- unregisterMBean((ObjectName) beans[i]);
+ unregisterMBean(beans[i]);
} catch (Exception e) {
log.debug("Could not unregister mbean", e);
}
@@ -256,7 +256,7 @@
* @return the JMX object name of the service or null
*/
public ObjectName getSystemService(String serviceName) {
- return (ObjectName) systemServices.get(serviceName);
+ return systemServices.get(serviceName);
}
/**
@@ -266,7 +266,7 @@
*/
public ObjectName[] getSystemServices() {
ObjectName[] result = null;
- Collection col = systemServices.values();
+ Collection<ObjectName> col = systemServices.values();
result = new ObjectName[col.size()];
col.toArray(result);
return result;
@@ -362,7 +362,7 @@
* @return the JMX ObjectName of the MBean, or <code>null</code> if <code>customName</code> is invalid.
*/
public ObjectName createCustomComponentMBeanName(String type, String name) {
- Map result = new LinkedHashMap();
+ Map<String, String> result = new LinkedHashMap<String, String>();
result.put("ContainerName", container.getName());
result.put("Type", "Component");
result.put("Name", sanitizeString(name));
@@ -378,7 +378,7 @@
* @return the ObjectName
*/
public ObjectName createObjectName(MBeanInfoProvider provider) {
- Map props = createObjectNameProps(provider);
+ Map<String, String> props = createObjectNameProps(provider);
return createObjectName(props);
}
@@ -408,7 +408,7 @@
*
* @return the ObjectName
*/
- public ObjectName createObjectName(String domain, Map props) {
+ public ObjectName createObjectName(String domain, Map<String, String> props) {
StringBuffer sb = new StringBuffer();
sb.append(domain).append(':');
int i = 0;
@@ -437,7 +437,7 @@
* @param props
* @return the ObjectName
*/
- public ObjectName createObjectName(Map props) {
+ public ObjectName createObjectName(Map<String, String> props) {
return createObjectName(getJmxDomainName(), props);
}
@@ -447,7 +447,7 @@
* @param provider
* @return the ObjectName
*/
- public Map createObjectNameProps(MBeanInfoProvider provider){
+ public Map<String, String> createObjectNameProps(MBeanInfoProvider provider){
return createObjectNameProps(provider, false);
}
@@ -457,8 +457,8 @@
* @param provider
* @return the ObjectName
*/
- public Map createObjectNameProps(MBeanInfoProvider provider, boolean subTypeBeforeName) {
- Map result = new LinkedHashMap();
+ public Map<String, String> createObjectNameProps(MBeanInfoProvider provider, boolean subTypeBeforeName) {
+ Map<String, String> result = new LinkedHashMap<String, String>();
result.put("ContainerName", container.getName());
result.put("Type", sanitizeString(provider.getType()));
if (subTypeBeforeName && provider.getSubType() != null) {
@@ -563,12 +563,10 @@
result = new ObjectName(tmp);
}
catch (MalformedObjectNameException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ log.debug("Unable to build ObjectName", e);
}
catch (NullPointerException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ log.debug("Unable to build ObjectName", e);
}
return result;
}
@@ -613,7 +611,7 @@
if (!systemServices.containsKey(name)) {
throw new JBIException("A system service for the name " + name + " is not registered");
}
- ObjectName objName = (ObjectName)systemServices.remove(name);
+ ObjectName objName = systemServices.remove(name);
if (log.isDebugEnabled()) {
log.debug("Unregistering system service: " + objName);
}
Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/OperationInfoHelper.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/OperationInfoHelper.java?view=diff&rev=523842&r1=523841&r2=523842
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/OperationInfoHelper.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/OperationInfoHelper.java Thu Mar 29 14:21:34 2007
@@ -29,7 +29,7 @@
* @version $Revision$
*/
public class OperationInfoHelper {
- private List list = new ArrayList();
+ private List<MBeanOperationInfo> list = new ArrayList<MBeanOperationInfo>();
/**
* Add an operation
@@ -106,7 +106,7 @@
return result;
}
- private Method getMethod(Class theClass, String name, int numParams) {
+ private Method getMethod(Class<? extends Object> theClass, String name, int numParams) {
Method result = null;
Method[] methods = theClass.getMethods();
if (methods != null) {
Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/messaging/DeliveryChannelImpl.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/messaging/DeliveryChannelImpl.java?view=diff&rev=523842&r1=523841&r2=523842
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/messaging/DeliveryChannelImpl.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/messaging/DeliveryChannelImpl.java Thu Mar 29 14:21:34 2007
@@ -17,7 +17,6 @@
package org.apache.servicemix.jbi.messaging;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -66,12 +65,12 @@
private JBIContainer container;
private ComponentContextImpl context;
private ComponentMBeanImpl component;
- private BlockingQueue queue;
+ private BlockingQueue<MessageExchangeImpl> queue;
private IdGenerator idGenerator = new IdGenerator();
private MessageExchangeFactory inboundFactory;
private int intervalCount = 0;
private AtomicBoolean closed = new AtomicBoolean(false);
- private Map waiters = new ConcurrentHashMap();
+ private Map<Thread, Boolean> waiters = new ConcurrentHashMap<Thread, Boolean>();
private TransactionManager transactionManager = null;
/**
@@ -79,7 +78,7 @@
* as the one sent (because it has been serialized/deserialized.
* We thus need to keep the original exchange in a map and override its state.
*/
- private Map exchangesById = new ConcurrentHashMap();
+ private Map<String, MessageExchangeImpl> exchangesById = new ConcurrentHashMap<String, MessageExchangeImpl>();
/**
* Constructor
@@ -87,7 +86,7 @@
public DeliveryChannelImpl(ComponentMBeanImpl component) {
this.component = component;
this.container = component.getContainer();
- this.queue = new ArrayBlockingQueue(component.getInboundQueueCapacity());
+ this.queue = new ArrayBlockingQueue<MessageExchangeImpl>(component.getInboundQueueCapacity());
this.transactionManager = (TransactionManager) this.container.getTransactionManager();
}
@@ -108,18 +107,17 @@
if (log.isDebugEnabled()) {
log.debug("Closing DeliveryChannel " + this);
}
- List pending = new ArrayList(queue.size());
+ List<MessageExchangeImpl> pending = new ArrayList<MessageExchangeImpl>(queue.size());
queue.drainTo(pending);
- for (Iterator iter = pending.iterator(); iter.hasNext();) {
- MessageExchangeImpl messageExchange = (MessageExchangeImpl) iter.next();
+ for (MessageExchangeImpl messageExchange : pending) {
if (messageExchange.getTransactionContext() != null && messageExchange.getMirror().getSyncState() == MessageExchangeImpl.SYNC_STATE_SYNC_SENT) {
notifyExchange(messageExchange.getMirror(), messageExchange.getMirror(), "close");
}
}
// Interrupt all blocked thread
- Object[] threads = waiters.keySet().toArray();
+ Thread[] threads = waiters.keySet().toArray(new Thread[waiters.size()]);
for (int i = 0; i < threads.length; i++) {
- ((Thread) threads[i]).interrupt();
+ threads[i].interrupt();
}
// deactivate all endpoints from this component
ServiceEndpoint[] endpoints = container.getRegistry().getEndpointsForComponent(component.getComponentNameSpace());
@@ -251,7 +249,7 @@
public MessageExchange accept(long timeoutMS) throws MessagingException {
try {
checkNotClosed();
- MessageExchangeImpl me = (MessageExchangeImpl) queue.poll(timeoutMS, TimeUnit.MILLISECONDS);
+ MessageExchangeImpl me = queue.poll(timeoutMS, TimeUnit.MILLISECONDS);
if (me != null) {
// If the exchange has already timed out,
// do not give it to the component
@@ -545,7 +543,7 @@
// Check if the delivery channel has been closed
checkNotClosed();
// Retrieve the original exchange sent
- MessageExchangeImpl original = (MessageExchangeImpl) exchangesById.get(me.getKey());
+ MessageExchangeImpl original = exchangesById.get(me.getKey());
if (original != null && me != original) {
original.copyFrom(me);
me = original;
Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/monitoring/StatisticsService.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/monitoring/StatisticsService.java?view=diff&rev=523842&r1=523841&r2=523842
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/monitoring/StatisticsService.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/monitoring/StatisticsService.java Thu Mar 29 14:21:34 2007
@@ -61,8 +61,8 @@
private static final Log log = LogFactory.getLog(StatisticsService.class);
- private ConcurrentHashMap componentStats = new ConcurrentHashMap();
- private ConcurrentHashMap endpointStats = new ConcurrentHashMap();
+ private ConcurrentHashMap<String, ComponentStats> componentStats = new ConcurrentHashMap<String, ComponentStats>();
+ private ConcurrentHashMap<String, EndpointStats> endpointStats = new ConcurrentHashMap<String, EndpointStats>();
private ComponentListener componentListener;
private EndpointListener endpointListener;
@@ -109,7 +109,7 @@
dumpStats = value;
}
- protected Class getServiceMBean() {
+ protected Class<StatisticsServiceMBean> getServiceMBean() {
return StatisticsServiceMBean.class;
}
@@ -118,12 +118,12 @@
}
public void resetAllStats() {
- for (Iterator it = componentStats.values().iterator(); it.hasNext();) {
- ComponentStats stats = (ComponentStats) it.next();
+ for (Iterator<ComponentStats> it = componentStats.values().iterator(); it.hasNext();) {
+ ComponentStats stats = it.next();
stats.reset();
}
- for (Iterator it = endpointStats.values().iterator(); it.hasNext();) {
- EndpointStats stats = (EndpointStats) it.next();
+ for (Iterator<EndpointStats> it = endpointStats.values().iterator(); it.hasNext();) {
+ EndpointStats stats = it.next();
stats.reset();
}
}
@@ -145,8 +145,8 @@
public void stop() throws javax.jbi.JBIException {
this.container.removeListener(exchangeListener);
super.stop();
- for (Iterator it = componentStats.values().iterator(); it.hasNext();) {
- ComponentStats stats = (ComponentStats) it.next();
+ for (Iterator<ComponentStats> it = componentStats.values().iterator(); it.hasNext();) {
+ ComponentStats stats = it.next();
stats.close();
}
if (timerTask != null) {
@@ -215,7 +215,7 @@
protected void onComponentShutDown(ComponentEvent event) {
ComponentMBeanImpl component = event.getComponent();
String key = component.getName();
- ComponentStats stats = (ComponentStats) componentStats.remove(key);
+ ComponentStats stats = componentStats.remove(key);
if (stats == null) {
return;
}
@@ -234,7 +234,7 @@
protected void onEndpointRegistered(EndpointEvent event) {
AbstractServiceEndpoint endpoint = (AbstractServiceEndpoint) event.getEndpoint();
String key = EndpointSupport.getUniqueKey(endpoint);
- ComponentStats compStats = (ComponentStats) componentStats.get(endpoint.getComponentNameSpace().getName());
+ ComponentStats compStats = componentStats.get(endpoint.getComponentNameSpace().getName());
EndpointStats stats = new EndpointStats(endpoint, compStats.getMessagingStats());
endpointStats.putIfAbsent(key, stats);
// Register MBean
@@ -254,7 +254,7 @@
protected void onEndpointUnregistered(EndpointEvent event) {
AbstractServiceEndpoint endpoint = (AbstractServiceEndpoint) event.getEndpoint();
String key = EndpointSupport.getUniqueKey(endpoint);
- EndpointStats stats = (EndpointStats) endpointStats.remove(key);
+ EndpointStats stats = endpointStats.remove(key);
// Register MBean
ManagementContext context= container.getManagementContext();
try {
@@ -280,14 +280,14 @@
String source = (String) me.getProperty(JbiConstants.SENDER_ENDPOINT);
if (source == null) {
source = mei.getSourceId().getName();
- ComponentStats stats = (ComponentStats) componentStats.get(source);
+ ComponentStats stats = componentStats.get(source);
stats.incrementOutbound();
} else {
ServiceEndpoint[] ses = getContainer().getRegistry().getEndpointRegistry().getAllEndpointsForComponent(mei.getSourceId());
for (int i = 0; i < ses.length; i++) {
if (EndpointSupport.getKey(ses[i]).equals(source)) {
source = EndpointSupport.getUniqueKey(ses[i]);
- EndpointStats stats = (EndpointStats) endpointStats.get(source);
+ EndpointStats stats = endpointStats.get(source);
stats.incrementOutbound();
break;
}
@@ -306,7 +306,7 @@
me instanceof MessageExchangeImpl)
{
String source = EndpointSupport.getUniqueKey(me.getEndpoint());
- EndpointStats stats = (EndpointStats) endpointStats.get(source);
+ EndpointStats stats = endpointStats.get(source);
stats.incrementInbound();
}
}
@@ -328,8 +328,8 @@
}
protected void doDumpStats() {
- for (Iterator it = componentStats.values().iterator(); it.hasNext();) {
- ComponentStats stats = (ComponentStats) it.next();
+ for (Iterator<ComponentStats> it = componentStats.values().iterator(); it.hasNext();) {
+ ComponentStats stats = it.next();
stats.dumpStats();
}
}
Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/monitoring/stats/StatsImpl.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/monitoring/stats/StatsImpl.java?view=diff&rev=523842&r1=523841&r2=523842
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/monitoring/stats/StatsImpl.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/monitoring/stats/StatsImpl.java Thu Mar 29 14:21:34 2007
@@ -30,13 +30,13 @@
* @version $Revision$
*/
public class StatsImpl extends StatisticImpl implements Stats, Resettable {
- private Map map;
+ private Map<String, StatisticImpl> map;
public StatsImpl() {
- this(new HashMap());
+ this(new HashMap<String, StatisticImpl>());
}
- public StatsImpl(Map map) {
+ public StatsImpl(Map<String, StatisticImpl> map) {
super("stats", "many", "Used only as container, not Statistic");
this.map = map;
}
@@ -53,18 +53,18 @@
}
public Statistic getStatistic(String name) {
- return (Statistic) map.get(name);
+ return map.get(name);
}
public String[] getStatisticNames() {
- Set keys = map.keySet();
+ Set<String> keys = map.keySet();
String[] answer = new String[keys.size()];
keys.toArray(answer);
return answer;
}
public Statistic[] getStatistics() {
- Collection values = map.values();
+ Collection<StatisticImpl> values = map.values();
Statistic[] answer = new Statistic[values.size()];
values.toArray(answer);
return answer;
Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/nmr/DefaultBroker.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/nmr/DefaultBroker.java?view=diff&rev=523842&r1=523841&r2=523842
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/nmr/DefaultBroker.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/nmr/DefaultBroker.java Thu Mar 29 14:21:34 2007
@@ -124,7 +124,7 @@
subscriptionManager.init(this, registry);
}
- protected Class getServiceMBean() {
+ protected Class<BrokerMBean> getServiceMBean() {
return BrokerMBean.class;
}
@@ -384,7 +384,7 @@
* @return an array of endpoints on which both consumer and provider agrees
*/
protected ServiceEndpoint[] getMatchingEndpoints(ServiceEndpoint[] endpoints, MessageExchangeImpl exchange) {
- List filtered = new ArrayList();
+ List<ServiceEndpoint> filtered = new ArrayList<ServiceEndpoint>();
ComponentMBeanImpl consumer = getRegistry().getComponent(exchange.getSourceId());
for (int i = 0; i < endpoints.length; i++) {
@@ -400,7 +400,7 @@
}
filtered.add(endpoints[i]);
}
- return (ServiceEndpoint[]) filtered.toArray(new ServiceEndpoint[filtered.size()]);
+ return filtered.toArray(new ServiceEndpoint[filtered.size()]);
}
/**
Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/nmr/SubscriptionManager.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/nmr/SubscriptionManager.java?view=diff&rev=523842&r1=523841&r2=523842
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/nmr/SubscriptionManager.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/nmr/SubscriptionManager.java Thu Mar 29 14:21:34 2007
@@ -73,10 +73,10 @@
protected boolean dispatchToSubscribers(MessageExchangeImpl exchange) throws JBIException {
Boolean source = (Boolean) exchange.getProperty(FROM_SUBSCRIPTION_MANAGER);
if (source == null || !source.booleanValue()) {
- List list = registry.getMatchingSubscriptionEndpoints(exchange);
+ List<InternalEndpoint> list = registry.getMatchingSubscriptionEndpoints(exchange);
if (list != null) {
for (int i = 0; i < list.size(); i++) {
- InternalEndpoint endpoint = (InternalEndpoint)list.get(i);
+ InternalEndpoint endpoint = list.get(i);
dispatchToSubscriber(exchange, endpoint);
}
}