You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pubscribe-dev@ws.apache.org by sc...@apache.org on 2005/05/23 22:32:14 UTC
svn commit: r178014 - in /incubator/hermes/trunk: ./
src/site/content/tutorial/ src/site/content/tutorial/method_impls/
src/site/content/tutorial/src/ src/site/content/tutorial/src/example/
src/site/content/tutorial/src/example/filesystem/
src/site/content/tutorial/src/example/filesystem/backend/
src/site/content/tutorial/src/example/filesystem/callback/
Author: scamp
Date: Mon May 23 13:32:14 2005
New Revision: 178014
URL: http://svn.apache.org/viewcvs?rev=178014&view=rev
Log: (empty)
Added:
incubator/hermes/trunk/src/site/content/tutorial/src/
incubator/hermes/trunk/src/site/content/tutorial/src/example/
incubator/hermes/trunk/src/site/content/tutorial/src/example/filesystem/
incubator/hermes/trunk/src/site/content/tutorial/src/example/filesystem/backend/
incubator/hermes/trunk/src/site/content/tutorial/src/example/filesystem/backend/FileSystem.java
incubator/hermes/trunk/src/site/content/tutorial/src/example/filesystem/backend/UnixFileSystem.java
incubator/hermes/trunk/src/site/content/tutorial/src/example/filesystem/callback/
incubator/hermes/trunk/src/site/content/tutorial/src/example/filesystem/callback/BackupFrequencyCallback.java
incubator/hermes/trunk/src/site/content/tutorial/src/example/filesystem/callback/CommentCallback.java
incubator/hermes/trunk/src/site/content/tutorial/src/example/filesystem/callback/FsckPassNumberCallback.java
incubator/hermes/trunk/src/site/content/tutorial/src/example/filesystem/callback/MountPointCallback.java
incubator/hermes/trunk/src/site/content/tutorial/src/example/filesystem/callback/OptionsCallback.java
Modified:
incubator/hermes/trunk/maven.xml
incubator/hermes/trunk/src/site/content/tutorial/build.properties
incubator/hermes/trunk/src/site/content/tutorial/build.xml
incubator/hermes/trunk/src/site/content/tutorial/method_impls/filesys_resource_init.txt
Modified: incubator/hermes/trunk/maven.xml
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/maven.xml?rev=178014&r1=178013&r2=178014&view=diff
==============================================================================
--- incubator/hermes/trunk/maven.xml (original)
+++ incubator/hermes/trunk/maven.xml Mon May 23 13:32:14 2005
@@ -174,7 +174,6 @@
<fileset dir="${site.dest.dir}" />
</copy>
- <mkdir dir="${maven.dist.bin.assembly.dir}/usr" />
<copy todir="${maven.dist.bin.assembly.dir}">
<fileset dir="${basedir}">
Modified: incubator/hermes/trunk/src/site/content/tutorial/build.properties
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/site/content/tutorial/build.properties?rev=178014&r1=178013&r2=178014&view=diff
==============================================================================
--- incubator/hermes/trunk/src/site/content/tutorial/build.properties (original)
+++ incubator/hermes/trunk/src/site/content/tutorial/build.properties Mon May 23 13:32:14 2005
@@ -3,7 +3,7 @@
# Uncomment and modify the below lines if you would like to deploy to a
# hermes webapp located somewhere other than the default location of
# ../webapps/hermes (e.g. ${env.CATALINA_HOME}/webapps/hermes)
-#hermes.webapp.dir=${env.CATALINA_HOME}/webapps/hermes
+hermes.webapp.dir=${env.CATALINA_HOME}/webapps/hermes
# Uncomment and modify the below lines if you require a proxy to connect to external web sites
#http.proxyHost=proxy.xyz.com
Modified: incubator/hermes/trunk/src/site/content/tutorial/build.xml
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/site/content/tutorial/build.xml?rev=178014&r1=178013&r2=178014&view=diff
==============================================================================
--- incubator/hermes/trunk/src/site/content/tutorial/build.xml (original)
+++ incubator/hermes/trunk/src/site/content/tutorial/build.xml Mon May 23 13:32:14 2005
@@ -55,6 +55,26 @@
</wsdl2Java>
<delete dir="${tmp.dir}" />
+
+ <copy file="soapclient.xml" todir="${out.dir}/filesystem" />
+ <mkdir dir="${out.dir}/filesystem/src/java/example/filesystem" />
+ <copy todir="${out.dir}/filesystem/src/java/example/filesystem" >
+ <fileset dir="${basedir}/src/example/filesystem">
+ <include name="**/*.java"/>
+ </fileset>
+ </copy>
+
+ <mkdir dir="${out.dir}/filesystem/requests" />
+ <copy todir="${out.dir}/filesystem/requests" >
+ <fileset dir="${basedir}/requests">
+ <exclude name="**/Sysprops*.soap"/>
+ </fileset>
+ </copy>
+
+ <mkdir dir="${out.dir}/filesystem/method_impls" />
+ <copy todir="${out.dir}/filesystem/method_impls">
+ <fileset dir="${basedir}/method_impls" includes="**/filesys*"/>
+ </copy>
</target>
Modified: incubator/hermes/trunk/src/site/content/tutorial/method_impls/filesys_resource_init.txt
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/site/content/tutorial/method_impls/filesys_resource_init.txt?rev=178014&r1=178013&r2=178014&view=diff
==============================================================================
--- incubator/hermes/trunk/src/site/content/tutorial/method_impls/filesys_resource_init.txt (original)
+++ incubator/hermes/trunk/src/site/content/tutorial/method_impls/filesys_resource_init.txt Mon May 23 13:32:14 2005
@@ -3,48 +3,57 @@
super.init();
+ /**
+ * The ResourcePropertySet which contains all the defined ResourceProperties
+ */
+ org.apache.ws.resource.properties.ResourcePropertySet resourcePropertySet = getResourcePropertySet();
+ org.apache.ws.resource.properties.ResourceProperty resourceProperty = null;
+
+
+
/*
* This is where you should associate the backend instance with
* the resource instance for a given id.
*/
example.filesystem.backend.FileSystem m_fileSystem = new example.filesystem.backend.UnixFileSystem( m_id );
+ try{
/*
- * Initialize each of our properties by calling prop.add(propElem) and/or prop.setCallback(callback)...
+ * Initialize each of our properties by calling resourceProperty.add(propElem) and/or resourceProperty.setCallback(callback)...
*/
- org.apache.ws.resource.properties.ResourceProperty prop = m_propSet.get( FilesystemPropertyQNames.DEVICESPECIALFILE );
+ resourceProperty = resourcePropertySet.get( FilesystemPropertyQNames.DEVICESPECIALFILE );
DeviceSpecialFileDocument deviceDocXBean = DeviceSpecialFileDocument.Factory.newInstance();
deviceDocXBean.setDeviceSpecialFile( m_fileSystem.getDeviceSpecialFile() );
- prop.add( deviceDocXBean );
+ resourceProperty.add( deviceDocXBean );
- prop = m_propSet.get( FilesystemPropertyQNames.TYPE );
+ resourceProperty = resourcePropertySet.get( FilesystemPropertyQNames.TYPE );
TypeDocument typeDocXBean = TypeDocument.Factory.newInstance();
typeDocXBean.setType( m_fileSystem.getType() );
- prop.add( typeDocXBean );
+ resourceProperty.add( typeDocXBean );
BackupFrequencyDocument backupDocXBean = BackupFrequencyDocument.Factory.newInstance();
backupDocXBean.setBackupFrequency( m_fileSystem.getBackupFrequency() );
- prop = m_propSet.get( FilesystemPropertyQNames.BACKUPFREQUENCY );
- prop.add( backupDocXBean );
- prop.setCallback( new example.filesystem.callback.BackupFrequencyCallback( m_fileSystem ) );
+ resourceProperty = resourcePropertySet.get( FilesystemPropertyQNames.BACKUPFREQUENCY );
+ resourceProperty.add( backupDocXBean );
+ resourceProperty.setCallback( new example.filesystem.callback.BackupFrequencyCallback( m_fileSystem ) );
CommentDocument commentDocXBean = CommentDocument.Factory.newInstance();
commentDocXBean.setComment( m_fileSystem.getComment() );
- prop = m_propSet.get( FilesystemPropertyQNames.COMMENT );
- prop.add( commentDocXBean );
- prop.setCallback( new example.filesystem.callback.CommentCallback( m_fileSystem ) );
+ resourceProperty = resourcePropertySet.get( FilesystemPropertyQNames.COMMENT );
+ resourceProperty.add( commentDocXBean );
+ resourceProperty.setCallback( new example.filesystem.callback.CommentCallback( m_fileSystem ) );
FsckPassNumberDocument fsckDocXBean = FsckPassNumberDocument.Factory.newInstance();
fsckDocXBean.setFsckPassNumber( m_fileSystem.getFsckPassNumber() );
- prop = m_propSet.get( FilesystemPropertyQNames.FSCKPASSNUMBER );
- prop.add( fsckDocXBean );
- prop.setCallback( new example.filesystem.callback.FsckPassNumberCallback( m_fileSystem ) );
+ resourceProperty = resourcePropertySet.get( FilesystemPropertyQNames.FSCKPASSNUMBER );
+ resourceProperty.add( fsckDocXBean );
+ resourceProperty.setCallback( new example.filesystem.callback.FsckPassNumberCallback( m_fileSystem ) );
MountPointDirectoryDocument mountPointDocXBean = MountPointDirectoryDocument.Factory.newInstance();
mountPointDocXBean.setMountPointDirectory( m_fileSystem.getMountPoint() );
- prop = m_propSet.get( FilesystemPropertyQNames.MOUNTPOINTDIRECTORY );
- prop.add( mountPointDocXBean );
- prop.setCallback( new example.filesystem.callback.MountPointCallback( m_fileSystem ) );
+ resourceProperty = resourcePropertySet.get( FilesystemPropertyQNames.MOUNTPOINTDIRECTORY );
+ resourceProperty.add( mountPointDocXBean );
+ resourceProperty.setCallback( new example.filesystem.callback.MountPointCallback( m_fileSystem ) );
OptionsDocument optionsDocXBean =
OptionsDocument.Factory.newInstance();
@@ -57,8 +66,67 @@
options.addOption( (String) backendOptions.get( i ) );
}
- prop = m_propSet.get( FilesystemPropertyQNames.OPTIONS );
- prop.add( optionsDocXBean );
- prop.setCallback( new example.filesystem.callback.OptionsCallback( m_fileSystem ) );
-
- }
+ resourceProperty = resourcePropertySet.get( FilesystemPropertyQNames.OPTIONS );
+ resourceProperty.add( optionsDocXBean );
+ resourceProperty.setCallback( new example.filesystem.callback.OptionsCallback( m_fileSystem ) );
+ }
+ catch (Exception e)
+ {
+ throw new javax.xml.rpc.JAXRPCException("There was a problem in initializing your resource properties. Please check your init() method. Cause: " + e.getLocalizedMessage());
+ }
+ // Resource Property {http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceLifetime-1.2-draft-01.xsd}TerminationTime is implemented by the framework.
+ // Resource Property {http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceLifetime-1.2-draft-01.xsd}CurrentTime is implemented by the framework.
+ // Resource Property {http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.xsd}FixedTopicSet is implemented by the framework.
+ // Resource Property {http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.xsd}Topic is implemented by the framework.
+ // Resource Property {http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.xsd}TopicExpressionDialects is implemented by the framework.
+
+
+
+ /**
+ * This method enables the ResourceTermination Topic for notifications
+ * about this resource's termination. If you would not like this
+ * behaviour either comment or remove the line of code.
+ */
+ try
+ {
+ org.apache.ws.notification.topics.util.TopicUtils.addResourceTerminationTopic( getTopicSpaceSet(), this, SPEC_NAMESPACE_SET );
+ }
+ catch (Exception e)
+ {
+ throw new javax.xml.rpc.JAXRPCException("Unable to init the ResourceTermination topic. Cause: " + e.getLocalizedMessage(), e);
+ }
+ /**
+ * This method call will make all resource properties be exposed
+ * as Topics. If you would like to change that behaviour you can
+ * call TopicUtils.addResourcePropertyValueChangeTopic for each
+ * Topic you'd like to expose property change notifications for.
+ */
+ try
+ {
+ org.apache.ws.notification.topics.util.TopicUtils.addResourcePropertyValueChangeTopics( getResourcePropertySet(), getTopicSpaceSet() );
+ }
+ catch (Exception e)
+ {
+ throw new javax.xml.rpc.JAXRPCException("Unable to init the ResourceProperty Changed topics. Cause: " + e.getLocalizedMessage(), e);
+ }
+
+ /**
+ * Initializes the Topic, TopicExpressionDialects and FixedTopicSet resource properties
+ *
+ * </br>
+ * <strong>NOTE this MUST be called last in the Resource.init() method to ensure all topics get registered</strong>
+ * </br>
+ * FixedTopicSet will be set based on the value returned from the {@see TopicSpaceSet#isFixed()} method.
+ * </br>
+ * Topic will have all root topics in the TopicSpaceSet, set to Simple dialect AND all child topics set ot
+ * Concrete dialect.
+ * </br>
+ *
+ * TopicExpressionDialects will be set to the engine's known Topic Dialects acquired from the TopicExpressionEngine
+ *
+ * @param topicSpaceSet
+ * @param propSet
+ */
+ org.apache.ws.notification.topics.util.TopicUtils.initNotificationProducerProperties(getTopicSpaceSet() , getResourcePropertySet());
+ }
+
\ No newline at end of file
Added: incubator/hermes/trunk/src/site/content/tutorial/src/example/filesystem/backend/FileSystem.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/site/content/tutorial/src/example/filesystem/backend/FileSystem.java?rev=178014&view=auto
==============================================================================
--- incubator/hermes/trunk/src/site/content/tutorial/src/example/filesystem/backend/FileSystem.java (added)
+++ incubator/hermes/trunk/src/site/content/tutorial/src/example/filesystem/backend/FileSystem.java Mon May 23 13:32:14 2005
@@ -0,0 +1,33 @@
+package example.filesystem.backend;
+
+import java.util.List;
+
+/**
+ * @author Sal Campana
+ */
+public interface FileSystem
+{
+ String getDeviceSpecialFile();
+
+ String getMountPoint();
+
+ void setMountPoint(String mountDir);
+
+ String getType();
+
+ int getBackupFrequency();
+
+ void setBackupFrequency(int backupFrequency);
+
+ List getOptions();
+
+ void setOptions(List options);
+
+ String getComment();
+
+ void setComment(String comment);
+
+ int getFsckPassNumber();
+
+ void setFsckPassNumber(int fsckPassNumber);
+}
Added: incubator/hermes/trunk/src/site/content/tutorial/src/example/filesystem/backend/UnixFileSystem.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/site/content/tutorial/src/example/filesystem/backend/UnixFileSystem.java?rev=178014&view=auto
==============================================================================
--- incubator/hermes/trunk/src/site/content/tutorial/src/example/filesystem/backend/UnixFileSystem.java (added)
+++ incubator/hermes/trunk/src/site/content/tutorial/src/example/filesystem/backend/UnixFileSystem.java Mon May 23 13:32:14 2005
@@ -0,0 +1,87 @@
+package example.filesystem.backend;
+
+import java.util.List;
+import java.util.ArrayList;
+
+
+/**
+ * This is a mock filesystem to act as the backend for the example FileSystemService
+ *
+ * @author Sal Campana
+ */
+public class UnixFileSystem implements FileSystem
+{
+
+ private String m_mountPoint="/usr";
+ private String m_type = "vxfs";
+ private int m_backupFrequency=0;
+ private int m_fsckPassNumber=2;
+ private List m_options;
+ private String m_comment="user files";
+ private String m_deviceSpecialFile = "/dev/vg00/lvol7";
+
+ public UnixFileSystem(String devicePath)
+ {
+ m_deviceSpecialFile = devicePath;
+ m_options = new ArrayList();
+ m_options.add("delaylog");
+ m_options.add("quota");
+ }
+
+ public String getDeviceSpecialFile()
+ {
+ return m_deviceSpecialFile;
+ }
+ public String getMountPoint()
+ {
+ return m_mountPoint;
+ }
+ public void setMountPoint(String mountDir)
+ {
+ m_mountPoint=mountDir;
+ }
+ public String getType()
+ {
+ return m_type;
+ }
+
+ public int getBackupFrequency()
+ {
+ return m_backupFrequency;
+ }
+
+ public void setBackupFrequency(int backupFrequency)
+ {
+ m_backupFrequency = backupFrequency;
+ }
+
+ public List getOptions()
+ {
+ return m_options;
+ }
+
+ public void setOptions(List options)
+ {
+ m_options = options;
+ }
+
+ public String getComment()
+ {
+ return m_comment;
+ }
+
+ public void setComment(String comment)
+ {
+ m_comment = comment;
+ }
+
+ public int getFsckPassNumber()
+ {
+ return m_fsckPassNumber;
+ }
+
+ public void setFsckPassNumber(int fsckPassNumber)
+ {
+ m_fsckPassNumber = fsckPassNumber;
+ }
+}
Added: incubator/hermes/trunk/src/site/content/tutorial/src/example/filesystem/callback/BackupFrequencyCallback.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/site/content/tutorial/src/example/filesystem/callback/BackupFrequencyCallback.java?rev=178014&view=auto
==============================================================================
--- incubator/hermes/trunk/src/site/content/tutorial/src/example/filesystem/callback/BackupFrequencyCallback.java (added)
+++ incubator/hermes/trunk/src/site/content/tutorial/src/example/filesystem/callback/BackupFrequencyCallback.java Mon May 23 13:32:14 2005
@@ -0,0 +1,48 @@
+package example.filesystem.callback;
+
+import org.apache.ws.resource.properties.SetResourcePropertyCallback;
+import org.apache.ws.resource.properties.ResourceProperty;
+import org.apache.ws.resource.properties.impl.CallbackFailedException;
+import org.apache.ws.resource.example.filesystem.BackupFrequencyDocument;
+import org.apache.xmlbeans.XmlInt;
+
+import javax.xml.namespace.QName;
+
+import example.filesystem.backend.FileSystem;
+
+/**
+ * A callback for the BackupFrequency resource property.
+ */
+public class BackupFrequencyCallback implements SetResourcePropertyCallback
+{
+ FileSystem m_fileSystem;
+
+ public BackupFrequencyCallback(FileSystem fileSystem)
+ {
+ m_fileSystem = fileSystem;
+ }
+
+ public void deleteProperty(QName propQName) throws CallbackFailedException
+ {
+ return; // no need to implement - Apollo will never call delete for a prop whose minOccurs != 0
+ }
+
+ public void insertProperty(Object[] prop) throws CallbackFailedException
+ {
+ return; // no need to implement - Apollo will never call insert for a prop whose minOccurs == its maxOccurs
+ }
+
+ public void updateProperty(Object[] prop) throws CallbackFailedException
+ {
+ // BackupFrequency prop has cardinality of 1, so passed array will always have exactly one element
+ XmlInt xInt = (XmlInt) prop[0];
+ m_fileSystem.setBackupFrequency(xInt.getIntValue());
+ }
+
+ public ResourceProperty refreshProperty(ResourceProperty prop) throws CallbackFailedException
+ {
+ XmlInt xInt = (XmlInt) prop.get( 0 );
+ xInt.setIntValue( m_fileSystem.getBackupFrequency() );
+ return prop;
+ }
+}
Added: incubator/hermes/trunk/src/site/content/tutorial/src/example/filesystem/callback/CommentCallback.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/site/content/tutorial/src/example/filesystem/callback/CommentCallback.java?rev=178014&view=auto
==============================================================================
--- incubator/hermes/trunk/src/site/content/tutorial/src/example/filesystem/callback/CommentCallback.java (added)
+++ incubator/hermes/trunk/src/site/content/tutorial/src/example/filesystem/callback/CommentCallback.java Mon May 23 13:32:14 2005
@@ -0,0 +1,46 @@
+package example.filesystem.callback;
+
+import example.filesystem.backend.FileSystem;
+import org.apache.ws.resource.properties.ResourceProperty;
+import org.apache.ws.resource.properties.SetResourcePropertyCallback;
+import org.apache.ws.resource.properties.impl.CallbackFailedException;
+import org.apache.xmlbeans.XmlString;
+
+import javax.xml.namespace.QName;
+
+/**
+ * A callback for the Comment resource property.
+ */
+public class CommentCallback implements SetResourcePropertyCallback
+{
+ FileSystem m_fileSystem;
+
+ public CommentCallback( FileSystem fileSystem )
+ {
+ m_fileSystem = fileSystem;
+ }
+
+ public void deleteProperty( QName propQName ) throws CallbackFailedException
+ {
+ return; // no need to implement - Apollo will never call delete for a prop whose minOccurs != 0
+ }
+
+ public void insertProperty( Object[] propElems ) throws CallbackFailedException
+ {
+ // Comment prop has cardinality of 1, so passed array will always have exactly one element
+ XmlString xString = (XmlString) propElems[0];
+ m_fileSystem.setComment( xString.getStringValue() );
+ }
+
+ public void updateProperty( Object[] prop ) throws CallbackFailedException
+ {
+ insertProperty( prop );
+ }
+
+ public ResourceProperty refreshProperty( ResourceProperty prop ) throws CallbackFailedException
+ {
+ XmlString xString = (XmlString) prop.get( 0 );
+ xString.setStringValue( m_fileSystem.getComment() );
+ return prop;
+ }
+}
Added: incubator/hermes/trunk/src/site/content/tutorial/src/example/filesystem/callback/FsckPassNumberCallback.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/site/content/tutorial/src/example/filesystem/callback/FsckPassNumberCallback.java?rev=178014&view=auto
==============================================================================
--- incubator/hermes/trunk/src/site/content/tutorial/src/example/filesystem/callback/FsckPassNumberCallback.java (added)
+++ incubator/hermes/trunk/src/site/content/tutorial/src/example/filesystem/callback/FsckPassNumberCallback.java Mon May 23 13:32:14 2005
@@ -0,0 +1,49 @@
+package example.filesystem.callback;
+
+import org.apache.ws.resource.properties.SetResourcePropertyCallback;
+import org.apache.ws.resource.properties.ResourceProperty;
+import org.apache.ws.resource.properties.impl.CallbackFailedException;
+import org.apache.ws.resource.example.filesystem.FsckPassNumberDocument;
+import org.apache.xmlbeans.XmlInt;
+
+import javax.xml.namespace.QName;
+
+import example.filesystem.backend.FileSystem;
+
+
+/**
+ * A callback for the FsckPassNumber resource property.
+ */
+public class FsckPassNumberCallback implements SetResourcePropertyCallback
+{
+ FileSystem m_fileSystem;
+
+ public FsckPassNumberCallback(FileSystem fileSystem)
+ {
+ m_fileSystem = fileSystem;
+ }
+
+ public void deleteProperty(QName propQName) throws CallbackFailedException
+ {
+ return; // no need to implement - Apollo will never call delete for a prop whose minOccurs != 0
+ }
+
+ public void insertProperty(Object[] propElems) throws CallbackFailedException
+ {
+ return; // no need to implement - Apollo will never call insert for a prop whose minOccurs == its maxOccurs
+ }
+
+ public void updateProperty(Object[] propElems) throws CallbackFailedException
+ {
+ // FsckPassNumber prop has cardinality of 1, so passed array will always have exactly one element
+ XmlInt xInt = (XmlInt) propElems[0];
+ m_fileSystem.setFsckPassNumber(xInt.getIntValue());
+ }
+
+ public ResourceProperty refreshProperty(ResourceProperty prop) throws CallbackFailedException
+ {
+ XmlInt xInt = (XmlInt) prop.get( 0 );
+ xInt.setIntValue( m_fileSystem.getFsckPassNumber() );
+ return prop;
+ }
+}
Added: incubator/hermes/trunk/src/site/content/tutorial/src/example/filesystem/callback/MountPointCallback.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/site/content/tutorial/src/example/filesystem/callback/MountPointCallback.java?rev=178014&view=auto
==============================================================================
--- incubator/hermes/trunk/src/site/content/tutorial/src/example/filesystem/callback/MountPointCallback.java (added)
+++ incubator/hermes/trunk/src/site/content/tutorial/src/example/filesystem/callback/MountPointCallback.java Mon May 23 13:32:14 2005
@@ -0,0 +1,28 @@
+package example.filesystem.callback;
+
+import org.apache.ws.resource.properties.ResourcePropertyCallback;
+import org.apache.ws.resource.properties.ResourceProperty;
+import org.apache.ws.resource.properties.impl.CallbackFailedException;
+import org.apache.ws.resource.example.filesystem.MountPointDirectoryDocument;
+import org.apache.xmlbeans.XmlString;
+import example.filesystem.backend.FileSystem;
+
+/**
+ * A callback for the MountPoint resource property.
+ */
+public class MountPointCallback implements ResourcePropertyCallback
+{
+ FileSystem m_fileSystem;
+
+ public MountPointCallback(FileSystem fileSystem)
+ {
+ m_fileSystem = fileSystem;
+ }
+
+ public ResourceProperty refreshProperty(ResourceProperty prop) throws CallbackFailedException
+ {
+ XmlString xString = (XmlString) prop.get( 0 );
+ xString.setStringValue( m_fileSystem.getMountPoint() );
+ return prop;
+ }
+}
Added: incubator/hermes/trunk/src/site/content/tutorial/src/example/filesystem/callback/OptionsCallback.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/site/content/tutorial/src/example/filesystem/callback/OptionsCallback.java?rev=178014&view=auto
==============================================================================
--- incubator/hermes/trunk/src/site/content/tutorial/src/example/filesystem/callback/OptionsCallback.java (added)
+++ incubator/hermes/trunk/src/site/content/tutorial/src/example/filesystem/callback/OptionsCallback.java Mon May 23 13:32:14 2005
@@ -0,0 +1,120 @@
+/*=============================================================================*
+ * 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 example.filesystem.callback;
+
+import example.filesystem.backend.FileSystem;
+import org.apache.ws.resource.example.filesystem.OptionsDocument;
+import org.apache.ws.resource.properties.ResourceProperty;
+import org.apache.ws.resource.properties.SetResourcePropertyCallback;
+import org.apache.ws.resource.properties.impl.CallbackFailedException;
+
+import javax.xml.namespace.QName;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * A callback for the Options resource property.
+ */
+public class OptionsCallback
+ implements SetResourcePropertyCallback
+{
+ /**
+ * DOCUMENT_ME
+ */
+ FileSystem m_fileSystem;
+
+ /**
+ * Creates a new {@link OptionsCallback} object.
+ *
+ * @param fileSystem DOCUMENT_ME
+ */
+ public OptionsCallback( FileSystem fileSystem )
+ {
+ m_fileSystem = fileSystem;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param propQName DOCUMENT_ME
+ */
+ public void deleteProperty( QName propQName ) throws CallbackFailedException
+ {
+ return; // no need to implement - Apollo will never call delete for a prop whose minOccurs != 0
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param prop DOCUMENT_ME
+ */
+ public void insertProperty( Object[] prop ) throws CallbackFailedException
+ {
+ return; // no need to implement - Apollo will never call insert for a prop whose minOccurs == its maxOccurs
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param prop DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public ResourceProperty refreshProperty( ResourceProperty prop ) throws CallbackFailedException
+ {
+ Iterator iterator = prop.iterator();
+ while ( iterator.hasNext() )
+ {
+ OptionsDocument.Options o = (OptionsDocument.Options) iterator.next();
+ clearOptionsFromProperty( o );
+
+ //add current options...
+ List options = m_fileSystem.getOptions();
+ for ( int i = 0; i < options.size(); i++ )
+ {
+ o.addOption( options.get( i ).toString() );
+ }
+ }
+
+ return prop;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param prop DOCUMENT_ME
+ */
+ public void updateProperty( Object[] prop ) throws CallbackFailedException
+ {
+ List backendOptions = m_fileSystem.getOptions();
+ // Options prop has cardinality of 1, so passed array will always have exactly one element
+ OptionsDocument.Options o = (OptionsDocument.Options) prop[0];
+ String[] optionArray = o.getOptionArray();
+ for ( int j = 0; j < optionArray.length; j++ )
+ {
+ backendOptions.add( optionArray[j] );
+ }
+ }
+
+ private void clearOptionsFromProperty( OptionsDocument.Options o )
+ {
+ //remove the options...
+ for ( int i = 0; i < o.sizeOfOptionArray(); i++ )
+ {
+ o.removeOption( i );
+ }
+ }
+}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: hermes-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: hermes-dev-help@ws.apache.org