Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
package org.apache.geronimo.clustering.wadi;
import  org.codehaus.wadi.servicespace.InvocationMetaData;
import  org.codehaus.wadi.servicespace.ServiceAlreadyRegisteredException;
import  org.codehaus.wadi.servicespace.ServiceProxyFactory;
import  org.codehaus.wadi.servicespace.ServiceRegistry;
import  org.codehaus.wadi.servicespace.ServiceSpace;
import  org.codehaus.wadi.servicespace.admin.AdminServiceSpace;
import  org.codehaus.wadi.servicespace.admin.AdminServiceSpaceHelper;

$Rev$ $Date$
public class NodeServiceHelper {
    private final ServiceSpace serviceSpace;
    public NodeServiceHelper(Dispatcher dispatcher) {
        if (null == dispatcher) {
            throw new IllegalArgumentException("dispatcher is required");
        this. = getAdminServiceSpace(dispatcher);
    public NodeServiceHelper(ServiceSpace serviceSpace) {
        if (null == serviceSpace) {
            throw new IllegalArgumentException("serviceSpace is required");
        this. = serviceSpace;
    public void registerNodeService(NodeService nodeService) {
        ServiceRegistry serviceRegistry = .getServiceRegistry();
        try {
        } catch (ServiceAlreadyRegisteredException e) {
            throw new IllegalStateException("NodeService already registered."e);
    public NodeService getNodeServiceProxy(Peer peer) {
        ServiceProxyFactory proxyFactory = .getServiceProxyFactory(.,
            new Class[] { NodeService.class });
        InvocationMetaData invocationMetaData = proxyFactory.getInvocationMetaData();
        invocationMetaData.setTargets(new Peer[] {peer});
        return (NodeServiceproxyFactory.getProxy();
    protected ServiceSpace getAdminServiceSpace(Dispatcher dispatcher) {
        AdminServiceSpaceHelper helper = new AdminServiceSpaceHelper();
        AdminServiceSpace adminServiceSpace = helper.getAdminServiceSpace(dispatcher);
        return adminServiceSpace;
New to GrepCode? Check out our FAQ X