Yes, using an armature (bones). I tend to use a short bone as a base then extrude two more bones from that. Animate the two extruded bones so they end up going into the bottom part. I then weight paint the mesh so the top is fixed to the base bone. I've tended to find that if the base isn't tied to a non-moving base bone then the mesh can start to wander off. Keep in mind that what you see in Blender may not always be how the mesh moves in the sim.
The top half of the hydraulic lines can be weighted to the middle bone and the bottom half to the third bone.
Don't forget that you should only use rotation animation (no scaling).
This is quite a handy tutorial although it's talking about a joystick but it is a useful guide (you won't need to assign to animations to the one part). Only thing I wouldn't do from the tutorial is remapping the keyframes (start using the proper keyframes from the start) or baking the keyframes (mostly unnecessary).
I think the other thing you need to be careful of is retracting gear. I'm not sure on the current state but in the past I've had troubles attaching a bone to another animation. And by trouble I mean it wouldn't work. Although I have had no troubles attaching bones to visibility nodes so maybe things have changed since the last time I tried. You may find that you will need another bone to handle the gear moving into the down position rather than attaching it to the gear.
The other tip I can give is get the bones working in the sim first. You can worry about the details later but at first you going to need to do a lot of to and froing between the sim and Blender to get things sorted.