Web Cam: Installing a fresh copy

From CFTP

Jump to: navigation, search
  1. Download the latest version of the plug-in.
  2. Unzip the downloaded file webcam-x.xx-bin.zip into a temporary directory of your choice.
  3. Copy all the unzipped JAR files into the lib directory of your FTP server overwriting existing files. Manually remove old versions of duplicate JAR files.
  4. Run the update script in your FTP server directory to update the start-up scripts.


You need to create special web camera users. Let's create 2 users (one per web camera) with the most basic parameters possible. Do it now, create and configure quickcam and procam users according to the documentation of the plug-in your FTP server is using to manage users (this may be the Gateway plug-in as at the time of this writing no other plug-ins provide this functionality). You may select different names if you wish.


Next you have to update the conf/beans.xml file in your FTP server. Edit the file in you favourite editor and do the steps below.


Locate your current filesystem bean and rename it. Give it any other name, e.g. originalFilesystem, so it looks something like this (depends on the filesystem you are using):

<bean id="originalFilesystem" 
  class="com.coldcore.coloradoftp.plugin.hardfilesystem.HardFileSystem">
  <constructor-arg index="0" value="conf/filesystem.xml"/>
</bean>

And if you decide to un-install the plug-in later, do not forget to change the bean name back to filesystem.


Add the following 3 beans to the bottom of your beans.xml file:

<!-- Webcam plugin -->

<bean id="filesystem" 
  class="com.coldcore.coloradoftp.plugin.webcam.FileSystemWrapper">
  <constructor-arg index="0" ref="originalFilesystem"/>
  <property name="interceptors">
    <bean class="java.util.HashSet">
      <constructor-arg index="0">
        <set>
          <ref bean="quickCamera"/>
          <ref bean="proCamera"/>
        </set>
      </constructor-arg>
    </bean>
  </property>
</bean>
<bean id="quickCamera" 
  class="com.coldcore.coloradoftp.plugin.webcam.UploadInterceptor">
  <property name="username" value="quickcam"/>
  <property name="task">
    <bean class="com.coldcore.coloradoftp.plugin.webcam.task.HttpSubmitTask">
      <property name="submitUrl" value="http://localhost/stream"/>
      <property name="fileParameterName" value="picture"/>
      <property name="parameters">
        <map>
          <entry key="channel" value="garden"/>
          <entry key="password" value="upload987"/>
        </map>
      </property>
    </bean>
  </property>
</bean>
<bean id="proCamera" 
  class="com.coldcore.coloradoftp.plugin.webcam.UploadInterceptor">
  <property name="username" value="procam"/>
  <property name="task">
    <bean class="com.coldcore.coloradoftp.plugin.webcam.task.HttpSubmitTask">
      <property name="submitUrl" value="http://localhost/stream"/>
      <property name="fileParameterName" value="picture"/>
      <property name="parameters">
        <map>
          <entry key="channel" value="street"/>
          <entry key="password" value="upload987"/>
        </map>
      </property>
    </bean>
  </property>
</bean>

The first XML sample wraps your existing file system and sets 2 interceptors – one for each web camera user. The second and the third XML samples define interceptors – it is where you specify usernames of web camera users and tasks. Upon every upload the new file system will test if the name of a user transferring a file matches the username property configured in every interceptor. If not then the file-transfer request will be passed down to the underlying file system and handled as usual. Otherwise, a task will be executed and the file-transfer request will not progress to the underlying file system. This task will do all the work - reading the file and forwarding it to its configured destination.



Return to Plug-in: Web Cam

Personal tools