/*=============================================================================*
* Copyright 2004 The Apache Software Foundation
*
* Licensed 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* 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.ws.resource.properties.v1_2.porttype.impl;
import org.apache.ws.resource.AbstractPortType;
import org.apache.ws.resource.ResourceContext;
import org.apache.ws.resource.PropertiesResource;
import org.apache.ws.resource.i18n.Keys;
import org.apache.ws.resource.i18n.MessagesImpl;
import org.apache.ws.resource.properties.ResourceProperty;
import org.apache.ws.resource.properties.ResourcePropertyCallback;
import org.apache.ws.resource.properties.ResourcePropertySet;
import org.apache.ws.util.i18n.Messages;
import javax.xml.rpc.JAXRPCException;
import java.util.Iterator;
/**
* LOG-DONE
* @author Ian P. Springer
*/
public abstract class AbstractResourcePropertiesPortType
extends AbstractPortType
{
private static final Messages MSG = MessagesImpl.getInstance();
/**
* Creates a new {@link AbstractResourcePropertiesPortType} object.
*
* @param resourceContext DOCUMENT_ME
*/
protected AbstractResourcePropertiesPortType( ResourceContext resourceContext )
{
super( resourceContext );
}
/**
* DOCUMENT_ME
*
* @return DOCUMENT_ME
*/
protected final ResourcePropertySet getProperties( )
{
if ( !( getResource( ) instanceof PropertiesResource ) )
{
throw new JAXRPCException( MSG.getMessage( Keys.CALL_WSRP_OP_ON_NOPROP) );
}
return ( (PropertiesResource) getResource( ) ).getResourcePropertySet( );
}
protected void refreshAllProperties()
{
Iterator iterator = getProperties().iterator();
while (iterator.hasNext())
{
refreshProperty((ResourceProperty)iterator.next());
}
}
protected void refreshProperty( ResourceProperty prop )
{
ResourcePropertyCallback callBack = prop.getCallBack( );
if ( callBack != null )
{
callBack.refreshProperty( prop );
}
}
}