  We consider a Josephson junction system installed with a finite length
inhomogeneity, either of microresistor or of microresonator type. The system
can be modelled by a sine-Gordon equation with a piecewise-constant function to
represent the varying Josephson tunneling critical current. The existence of
pinned fluxons depends on the length of the inhomogeneity, the variation in the
Josephson tunneling critical current and the applied bias current. We establish
that a system may either not be able to sustain a pinned fluxon, or - for
instance by varying the length of the inhomogeneity - may exhibit various
different types of pinned fluxons. Our stability analysis shows that changes of
stability can only occur at critical points of the length of the inhomogeneity
as a function of the (Hamiltonian) energy density inside the inhomogeneity - a
relation we determine explicitly. In combination with continuation arguments
and Sturm-Liouville theory, we determine the stability of all constructed
pinned fluxons. It follows that if a given system is able to sustain at least
one pinned fluxon, there is exactly one stable pinned fluxon, i.e. the system
selects one unique stable pinned configuration. Moreover, it is shown that both
for microresistors and microresonators this stable pinned configuration may be
non-monotonic - something which is not possible in the homogeneous case.
Finally, it is shown that results in the literature on localised
inhomogeneities can be recovered as limits of our results on microresonators.
